Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Number of days between two days using FormCalc

_jadobe_
Level 2
Level 2
Hi All,

Is there anyway to get the number of days between two days using formcalc.



Thankd

JJ
0 Replies
pguerett
Level 10
Level 10
By days I assume you mean dates. You will need to transform the date into a number of milliseconds from an epoch. In FormCalc this is done using the Date2Num funnction. Once you convert both dates then you can subtract one from the other to get a difference then change it from milliseconds to whatever units you want.



This can be done in Javascript but it is more difficult.
pguerett
Level 10
Level 10
I came across a sample where I did this before. Remember that this is FormCalc. The function returns the number of days since the epoch not the number of milliseconds (thats what Javascript does). Here is the command I used:



xfa.host.messageBox(Date2Num(EndDate.rawValue, "YYYY-MM-DD") - Date2Num(StartDate.rawValue, "YYYY-MM-DD"))