Hi I'm trying to calculate the days between two dates on my form.
i've been reading through tutorials and most of them are add days onto days between dates.
http://www.bses.org.au/downloads/Steven_IT/travelworkout.pdf
this is my current form.
i've been working on getting drop down list populated by selecting A and gives you list in B .
then check B will give you a price in textfield C.
not sure if anyone can improve the code.
the last item is need is to calculate the difference in dates and then mulitply by C to get a total.
should i use formCal or use Javascript for this final function ?
i'm not sure how to code the calculate date.
we are trying to create a booking form for our staff for the hotels they may stay at.
kind regards
steven
Did you read the articles on dates and times?
http://www.acrobatusers.com/tutorials/2006/date_time_part2
This article has an example of of a date difference calculation that finds the number of days between two dates. The example is an AcroForm, but the technique is exactly the same on a LiveCycle form.
The first bit is to convert the Date strings in the text/date fields into JavaScript Date Objects, then find the difference with the "Date().getTime()" function. This will give you the difference in milliseconds. The last step is to convert the millisecond value into days, or whatever time unit you want.
You can also find gobs info on scripting with dates and times at 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]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script