I have a form where I am trying to put in a calculation to return the date a person will turn age 65.
The following code works, however, there are times when the returned date is off by a day.
Num2Date(Date2Num(DOB.formattedValue, "MMM D, YYYY") + (365.25*65))
Is there a better way I can calculate this or alternatively, can I have the returned date display only the month and day? I tried to change the field display to MMM, YYYY however, it still gives me a day of the month.
Thanks!
Num2Date(Date2Num(DOB.formattedValue, "MMM D, YYYY") + (365.25*65), "MMM, YYYY" )
And yes, there is a better way to do the calculation. You're a bit off because of rounding in the leap year fudge. A better method would be to simply split out the components of the DOB and add 65 to the year. Then rebuild the date strintg.
Something like this
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/]http://www.adobe.com/devnet/acrobat/[/url]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script