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

Adding 60 days to a date in an existing field

stavros74
Registered: Jul 16 2010
Posts: 1

I am a beginner to Acrobat and I need a java script to get a date field to auto populate a date 60 days into the future from an existing date field. So I need field number 1203 to take the date from field number 1202, add 60 days to it and display that date. Thank you in advance for your assistance and kind attention.

Steven Anderson

My Product Information:
Acrobat Pro 7.0, Macintosh
try67
Expert
Registered: Oct 30 2008
Posts: 2398
This tutorial will tell you everything you need to know about this subject:
[url]http://www.acrobatusers.com/tutorials/2006/date_time_part1[/url]

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

propic1
Registered: Nov 16 2006
Posts: 3
Hi...

I too am a beginner. I looked at the tutorial but it is in Java... Need help doing the same thing is FormCalc.

Thanks very much...
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
Acrobat JavaScript works with LiveCycle Designer, you can select the scripting language.

Have you looked at the "Scripting Reference" under LiveCycle Designer's menu bar 'Help" item?

You can use the "Date2Num()" function to get the number of days from the Epoch date, add 60 days to that value to obtain the number of days from the Epoch date in 60 days, and then use "Num2Date()" function to convert the number of days from the Epoch date to a formatted character string. See the following sample commented code.

// begin code
// get date string - format MM/DD/YYYY
var cDate = "09/23/2010"
// convert formatted string to days from Epoch date
var nDate = Date2Num(cDate, "MM/DD/YYYY")
// add 60 days
var nDate60 = nDate + 60
// convert day numberer to string
var cDate60 = Num2Date(nDate60, "MMM DD, YYYY")
// display results
// build display string
var cString = Concat("Start date: ", cDate, " - Date Number: ", nDate, "\u000d\u000a", "Date Number in 60 days: ", nDate60, " - Date in 60 days: ", cDate60)
// display message
xfa.host.messageBox (cString, "Results", 3)
// end code

Comments in FormCalc start with "//".

George Kaiser