DateAsNumber – XpressDox

If you want to compare two dates, then typically you want to know whether one date is later than another. The default way that dates are stored in XpressDox is in the format yyyy-MM-dd (e.g. 2018-05-02), but can also be understood by XpressDox in other formats, like “May 2, 2018”. The hyphens or other non-numeric characters inside the date means that the only comparison that can be made between two dates is whether they are equal or not. In order to compare two dates to see which one is before or after the other, the dates need to be made into numbers.

This could be be done by the following:

«If(FormatDate(Date1, ‘yyyyMMdd’) < FormatDate(Date2, ‘yyyMMdd’))»Date1 is less than Date2«End()»

The DateAsNumber function is a shortcut for the above (which is open to "finger trouble" and mis-typing), as follows:

«If(DateAsNumber(Date1) < DateAsNumber(Date2))»Date1 is less than Date2«End()»