These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Is it possible to create a date that is one month after today

ptc2010
Registered: Apr 27 2010
Posts: 3

but not using the 30 days or 60 days format. This date is for a banking document, so if today is April 27, the next date has to be shown as May 27, whether or not the month has 30 or 31 days.
Thanks.

My Product Information:
Acrobat Pro 9.0, Windows
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi ptc2101,

Yes, you can do pretty much any kind of date manipulation with Acrobat scripting for a PDF. You could just increment the Month and leave the date alone (of course if it is Jan 30 you can't have Feb 30th, but there are ways to take that into account also).

There are some tutorials here on Using Date and Time in Acrobat with scripting in the Learning Center and links there also for the Acrobat JavaScript Reference, where you can look up the Date Object for more specific info on it.

Hope this helps,

Dimitri
WindJack Solutions
www.pdfscripting.com
www.windjack.com
ptc2010
Registered: Apr 27 2010
Posts: 3
Thanks for your reply Dimitri.

Both of the websites you referenced cost money to join and I'm not able. I don't suppose you have any other free link or the script itself?
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi ptc2010,

All the tutorials here at AUC in the Learning Center are free. The Learning Center is the top left menu item on this page- select Tutorials and search under JavaScript for the Date and Time series. There are links in those articles for sample files with scripts you can examine as well. Not sure if there is an exact example for your case but the articles should be very helpful and get you a ways down the road with this.

Hope this helps,

Dimitri
WindJack Solutions
www.pdfscripting.com
www.windjack.com
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
The sites under Dimiti's signature are service sites she and Thom Parker are associated with. [url=http://www.windjack.com]windjack.com[/url] has a number of free scripts as well as products and services that can be purchased. This is a pretty well standardized signature block to point people to the poster's work sites. That being said, both Dimitri and Thom have and continue to provide free help and documentation, and they are more forthcoming about these sites than other posters that ask you to email them and then sell you information that in many cases is available for free here or other Acrobat forums.

Thom has provided a 3 part series on date and time calculations:
[url=http://www.acrobatusers.com/tutorials/2006/date_time_part1]Working with date and time in Acrobat JavaScript (Part 1 of 3)[/url]
[url=http://www.acrobatusers.com/tutorials/2006/date_time_part2]Working with date and time in Acrobat JavaScript (part 2 of 3)[/url]
[url=http://www.acrobatusers.com/tutorials/working-date-and-time-acrobat-javascript-part-3-3]Working with date and time in Acrobat JavaScript (part 3 of 3)[/url]

They do not cover all possible ways of performing date and time calculations. The one area that was not covered in the tutorials is JavaScript's ability to extract and use the full year, month, date, and day items of the JavaScipt's date time object. Earlier this week I responded to [url=http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=25517]Assistance with date calculation for newbie, please?[/url] that shows how to advance a date by 3 days using the full year, month and date of the date time object. The same technique can be used using the month of the date time object. The 'Date()' object accepts a couple of different parameters layouts and values and will automatically adjust if the days or months is greater than the allowed formatted values and create a new date time object that can then be properly formatted as needed.

Note, the nuber of days in a year (365 or 366 days) or a month (28, 29, 30, 0r 31 days) are not constant values like 24 hours in a day, so the use of the milliseconds for calculations for these values may not always work.

George

George Kaiser