Page 1 of 2 1 2 >
Topic Options
#55091 - 07/17/17 07:02 AM Show (date(true)) plus 7 days
neverett Offline
OL Newbie

Registered: 09/13/13
Posts: 10
Hi,

I am a user of the planet press software but not overly technical - I currently use a small bit of code in Planet Press talk to display the current date in letters. Show (date(true)).

Is it possible to generate todays date plus 7 days using a similar phrase?

Thanks
Nicola

Top
#55092 - 07/17/17 09:21 AM Re: Show (date(true)) plus 7 days [Re: neverett]
Raphael Lalonde Lefebvre Offline
OL Expert

Registered: 10/14/05
Posts: 4953
Loc: Objectif Lune Montreal
Hi Nicola,

Unfortunately, the "date" command only shows the current data. More specifically, it displays your system's date, and the date format is determined by your Windows date/region settings.

You will need to do some PressTalk in order to take the format of "date", and add days to it. Fortunately, we have plenty of premade PressTalk functions that you can use to play with date formatting, available on this page:
http://planetpress.objectiflune.com/en/suite/resources/support

Scroll down to the bottom of the page, and find the Libraries tab in the "Downloadable Resources" section. The "date functions" package is the one you want. Unzip it in a folder, then in PlanetPress, go to Tools->Global Function Library Manager. Go to File->Manage Folders, and select the folder that contains the library. You will now be able to import all the functions in your document by dragging them from "Libraries" to "Global functions in document". It is best to import all functions, even if you don't need all of them, because there can be dependencies between the functions. Once they are imported, you will see them in the document's global functions. You can double-click on them to open them, and check their code, along with some information on how to use them.

Finally, here's an example of a custom data selection that will display today's date + 7, using "AddDaysToDate":

=@AddDaysToDate(date(false), 'YYYY-MM-DD', 7)

This will turn "2017-07-17" into "2017-07-24". As I was saying, the format returned by "date" is dependent on your system's date settings, so your date format might be different. You may have to adjust the "YYYY-MM-DD' part of the code to match your system's date format.

Hope that helps!

Regards,
Raphaël Lalonde-Lefebvre

Top
#55097 - 07/18/17 03:38 AM Re: Show (date(true)) plus 7 days [Re: neverett]
neverett Offline
OL Newbie

Registered: 09/13/13
Posts: 10
Perfect thank you so much.

Top
#55131 - 07/31/17 07:10 AM Re: Show (date(true)) plus 7 days [Re: neverett]
neverett Offline
OL Newbie

Registered: 09/13/13
Posts: 10
Hello, sorry one more question on this, it is currently returning the short date and we would like the long date.

I have changed it to 'true' and changed the date format to match the windows regional settings but am getting a 'DateError'.

=@AddDaysToDate(date(true), 'DD MMMM YYYY', 7)

Are you able to help with this?

Thanks

Top
#56818 - 03/05/19 01:33 PM Re: Show (date(true)) plus 7 days [Re: neverett]
Sami786 Offline
OL Expert

Registered: 01/29/14
Posts: 324
Loc: Home
I need help on the same topic, I tried and followed the steps but it's not working for me.

I imported all the functions in my document by dragging them from "Libraries" to "Global functions in document".

Then on the page I dragged a "Press Talk" object and I pasted the below code,

=@AddDaysToDate(date(false), 'YYYY-MM-DD', 7)

It's not working for me, and it's given error messages. Where did I do wrong ?
Error: Unknown instruction
Your help is appreciated.

We have two (dates) in the data file:
Pay date: March 9, 2019
Final date: February 27, 2019 = this is wrong Final date should be at least 8 days greater, the correct Final date should be March 17, 2019. So now I need to print the correct Final date. How do I do this?

your help is appreciated.


Edited by Sami786 (03/05/19 01:35 PM)
_________________________
Peace

Top
#56819 - 03/05/19 02:42 PM Re: Show (date(true)) plus 7 days [Re: neverett]
Jean-Cédric Online   content
OL Expert

Registered: 10/03/16
Posts: 479
Loc: Québec, Canada
Have you look at the comments inside the function? Sometimes it will tell you that another function/library is mandatory.

Top
#56824 - 03/06/19 04:12 PM Re: Show (date(true)) plus 7 days [Re: neverett]
Sami786 Offline
OL Expert

Registered: 01/29/14
Posts: 324
Loc: Home
There's nothing to say another function library is mandatory.

I also get the system date in my custom data selection like

Wednesday, march 06, 2019

how can I remove Wednesday?

=date(true)
_________________________
Peace

Top
#56825 - 03/06/19 04:33 PM Re: Show (date(true)) plus 7 days [Re: neverett]
Jean-Cédric Online   content
OL Expert

Registered: 10/03/16
Posts: 479
Loc: Québec, Canada
To help you properly we would need to see the Template and reproduce the issue. I suggest you open a technical support call at 1-866-348-5863 or through our website.

Top
#56912 - 04/04/19 10:22 AM Re: Show (date(true)) plus 7 days [Re: neverett]
rfielder Offline
OL Toddler

Registered: 10/28/15
Posts: 32
Two questions:

First - when one loads a library, where is the documentation? I can't find any notes, and when I try to use @DaysBetweenDates(), PlanetPress is telling me "too few or too many parameters".

Second - the last messages in this discussion are dated March 5 and 6, 2019. Today is March 4. Why am I reading messages from the future? smile

Top
#56913 - 04/04/19 10:48 AM Re: Show (date(true)) plus 7 days [Re: neverett]
Jean-Cédric Online   content
OL Expert

Registered: 10/03/16
Posts: 479
Loc: Québec, Canada
Euhhh...today is April 4....and April's fool was 3 days ago...stop joking!!! wink

Top
Page 1 of 2 1 2 >