DateCompare

Compares the difference between two dates - returning 0 if equal, -1 if date2 is less than date1 and 1 if the inverse

Method Signature

DateCompare(date1=[any], date2=[any], datepart=[string])

Arguments

Argument
Type
Required
Description
Default

date1

any

true

The reference date object

date2

any

true

The date which to compare against date1

datepart

string

false

Examples

Compare Two Dates by Year

Run Example

dateCompare( "12/30/2015", "12/02/2015", "yyyy" );

Result: 0

Compare Two Dates by Day

Returns 1 because date1 is greater than date 2

Run Example

Result: 1

Member function example

Run Example

Result: -1

Additional Examples

Run Example

Run Example

Last updated

Was this helpful?