Comparing Dates

Date comparisons can be tricky, especially if you try to use simple statements testing for LESS THAN and GREATER THEN. The safe (and correct) way to compare dates is to use the DateCompare() function which lets you specify two dates as well as an optional comparison decision level. The latter lets you specify whether you want to compare precise to the year, month, day, hour, minute, or second. And the value returned by DateCompare() will tell you if the two dates match or not, and if not, which is earlier and which is later. (Applies to: ColdFusion All)

Leave a Reply