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

date calculations

danm
Registered: May 28 2009
Posts: 9
Answered

I am trying to set up a form with 3 tex boxes, text box one is the current date, text box 2 is a number of days and text box 3 is the calculatio of the previous 2 in other words I want to add days to a date

My Product Information:
Acrobat Pro 9.0, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You'll find everything you need in this article series:

http://www.acrobatusers.com/tutorials/2006/date_time_part1


You'll find more detailed information on calculations and on Date and time handling at
http://www.pdfscripting.com

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

danm
Registered: May 28 2009
Posts: 9
Thanks thomp-I am new to this and must be dumb but I just can't figure out haw to set these 3 text foelds up-it seem to be simple but it eludes me. The key to my form is entering the number of days and getting the date in the 3rd box by adding the origional date to the days box.
I am confused
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The task you want to perform requires a calculation script. Scripting is not an easy thing and requires a bit of experience with programming concepts. So you have to spend a little bit of time coming up to speed on scripting. If you need this tasks to be done quicker then you should consider hiring a programmer.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
You have to create a custom calculation script for the 3rd field


// add days to current date and set value of this field// get current date time objectvar oNow = new Date();// get the number of days to add to the current datevar fAddDays = this.getField('Field2Name').value;// add fAddDays to current date's object dateoNow.setDate(oNow.getDate() + Number(fAddDays) );// set field value to current date plus number of days formattedevent.value = util.printd('mmm d, yyyy', oNow);

George Kaiser

danm
Registered: May 28 2009
Posts: 9
This works great-you are a genious-I have been trying to figure this out for a while
thanks so much