Show (date(true)) plus 7 days

Posted by: neverett

Show (date(true)) plus 7 days - 07/17/17 07:02 AM

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
Posted by: Raphael Lalonde Lefebvre

Re: Show (date(true)) plus 7 days - 07/17/17 09:21 AM

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
Posted by: neverett

Re: Show (date(true)) plus 7 days - 07/18/17 03:38 AM

Perfect thank you so much.
Posted by: neverett

Re: Show (date(true)) plus 7 days - 07/31/17 07:10 AM

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
Posted by: Sami786

Re: Show (date(true)) plus 7 days - 03/05/19 01:33 PM

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.
Posted by: Jean-Cédric

Re: Show (date(true)) plus 7 days - 03/05/19 02:42 PM

Have you look at the comments inside the function? Sometimes it will tell you that another function/library is mandatory.
Posted by: Sami786

Re: Show (date(true)) plus 7 days - 03/06/19 04:12 PM

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)
Posted by: Jean-Cédric

Re: Show (date(true)) plus 7 days - 03/06/19 04:33 PM

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.
Posted by: rfielder

Re: Show (date(true)) plus 7 days - 04/04/19 10:22 AM

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
Posted by: Jean-Cédric

Re: Show (date(true)) plus 7 days - 04/04/19 10:48 AM

Euhhh...today is April 4....and April's fool was 3 days ago...stop joking!!! wink
Posted by: rfielder

Re: Show (date(true)) plus 7 days - 04/04/19 12:05 PM

Jean-Cédric - sorry, I am about a month behind. Duh!

It makes sense now.

Now - as to any documentation for the functions in the Date library?
Posted by: Jean-Cédric

Re: Show (date(true)) plus 7 days - 04/04/19 12:24 PM

Unfortunately, no...there is none but some function comes with comments from their programmers.
Posted by: rfielder

Re: Show (date(true)) plus 7 days - 04/04/19 12:28 PM

It gets even better - when I use @DaysBetweenDates(), the error messages fall off the side of the dialogue box to the point that you actually don't see anything more than one or two letters of the actual error.
Posted by: Jean-Cédric

Re: Show (date(true)) plus 7 days - 04/04/19 12:31 PM

To help you properly we would need to see the Template and reproduce the issue. I suggest you open a technical support call through our website.