DateDiff()

Returns the difference between the specified dates (or between the specified date and current time step) in the specified time increment.

Returns positive values when the first date is later than the second date, and negative values if the first date is earlier than the second date.

Syntax

DateDiff (date, increment)
    • date:  date to compare to the current time step
    • increment: time increment (Daily, Monthly, etc.)

Examples

DateDiff(Now(), Step Daily) returns the difference in days between Now() and the 
current step.

DateDiff(#02/24/2015 08:00, Step Daily) returns the difference in days between
February 24, 2015 and the current step.

Syntax

DateDiff(start date, end date, increment)
    • start date:  start date to compare
    • end date: end date to compare
    • increment: time increment (Daily, Monthly, etc.)

Examples

DateDiff(#1/1/2023#, #1/1/2022#, Step Monthly) returns 12.

DateDiff(#1/1/2022#, #1/1/2023#, Step Monthly) returns -12.

DateDiff(FromStart(), Now(), Step Monthly)

DateDiff(#02/28/2015 08:00#, #02/24/2015 08:00#, Step Daily)

Date/Time Functions

Day, DayOfYear, Minute, Hour, Month, Millisecond, Second, Year

Returns the day/the day of year/ minute/ hour/ month/ millisecond/ second/year component of the specified time or current time step.

Syntax

Day(date)

DayOfYear(date)

Minute(date)

Hour(date)

Month(date)

Millisecond(date)

Second(date)

Year(date)
    • date:  optional, if this argument is not specified, current time step will be used.

Examples

Year()

Month(#05/16/2000#)

DayOfYear(Now())