Duration
The Duration function calculates the duration between two datetimes,
expressed in the configured unit.
If the from datetime is more recent than the to datetime, the step fails
(DateFromIsMoreRecentThanTo) — the function never returns a negative result.
Parameters
The time unit for the output. Accepted values are the lowercase strings
microsecond, millisecond, second, minute, hour, day, week,
month, year. Note these differ from the capitalized units used by
DateAdd / DateSubtract.
Input
The start date and time. Accepts a Datetime value only (not a Date).
The end date and time. Accepts a Datetime value only (not a Date).
Output
The duration between the two datetimes, expressed in the configured unit.
month and year are calendar-based deltas, not fixed-length divisions:
month counts whole calendar months using year/month arithmetic (minus one
if the to day of month is smaller than the from day), and year counts
whole elapsed years between the two dates.