Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: stonysmithLet's assume that the two fields are strings. First you must convert them to dates:
d1=date1.date("DD-MM-CCYY")
d2=date2.date("DD-MM-CCYY")
Then, to compare the two dates you can simply do this:
if d1 > d2 then .....action.........
To find out the difference between two dates:
diff = dateSubtract(d1,d2)
Lastly, if d1 (should be) the earlier of the two dates:
if d1 > d2 then diff = dateSubtract(d2,d1) else diff = dateSubtract(d1,d2)
However, that can also be done simpler with this:
diff = abs(dateSubtract(d1,d2))