Forum Moderators: open

Message Too Old, No Replies

Date subtraction in Acrobat

         

lenpartico

6:03 am on Dec 28, 2004 (gmt 0)

10+ Year Member




Hi,
I am trying to do a date subtraction script in Acrobat "custom calculation script", I am not versed in Javascript, but this is what I have:
One field is Date1 and the other field is Date2 and the answer field is Period. I will enter a date in Date 1 and another date in Date2 and Period will give the period of time between the two dates in weeks.

var date1 = this.getField("Date1").value;
var date2 = this.getField("Date2").value;
function period(date1, date2)
{
var period = (date1-date2);

return period/1000/3600/168;
}

It don't seem to work, any help will be appreciated.
Thanks

RonPK

7:59 pm on Jan 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There seems to be a problem with it.

Which line, please.

lenpartico

8:39 pm on Jan 1, 2005 (gmt 0)

10+ Year Member



T don't know but the debugger states that the date should be in the format mmm d, yyyy and it is in that format already.
Thanks.

lenpartico

9:31 pm on Jan 1, 2005 (gmt 0)

10+ Year Member



This is the message:
Invalid date /time: please ensure that the date / time exists. Field[NewDate] should match format mmm d, yyyy

RonPK

10:12 pm on Jan 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry lenpartico, I give up, mainly because I have no access to Acrobat the way you have. Good luck!

lenpartico

10:22 pm on Jan 1, 2005 (gmt 0)

10+ Year Member



OK, Thanks.
This 35 message thread spans 2 pages: 35