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

Date2Num, impossibility to calculate number of days from a field Date/

v.griesser
Registered: May 16 2008
Posts: 3
Answered

Hi everybody,

I'm trying hard to calculate the number of days from 2 fields "Date/hour" fill from the calender interface, with no success.

I have tried this approach :

- creation of 2 fields "Date_1" and "Date_2" (type Date/hour), format D/M/YY.
- creation of 2 numeric fields "Num_1" and "Num_2" for the result of the number of days using the following FormCal script :
Date2Num("Date_1", "D/M/YY").
The result is always O.
I have tried to play with different formats and regional parameters.

Where do I do wrong ? Could you please help me ? Thanks for attention.

My Product Information:
LiveCycle Designer, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Quotes are used to denote text strings and not field names in FormCalc. I have also found that specifying the type of value when using the format parameter in the date time functions solves some problems.

For the calculation script try:

Date2Num(Date_1.formattedValue, "D/M/YY")

George Kaiser

v.griesser
Registered: May 16 2008
Posts: 3
gkaiseril wrote:
Quotes are used to denote text strings and not field names in FormCalc. I have also found that specifying the type of value when using the format parameter in the date time functions solves some problems.For the calculation script try:

Date2Num(Date_1.formattedValue, "D/M/YY")
Thank you for your answer it has solved the problem. Wonderful !
For the calculation of the number of days between two dates I have used that script that works :

(Date2Num(Date_2.formattedValue, "D/M/YY"))-(Date2Num(Date_1.formattedValue, "D/M/YY"))

Best regard, V.