Column.date_diff
date_diffendperiod
Group: DateTime
Documentation
Computes a time difference between the two dates. It returns a column of integers expressing how many periods fit between the two dates/times. The difference will be positive if end
is greater than self
.
Arguments
end
: A date/time column or a date/time value to compute the difference from. It should have the same type as the current column, i.e. aDate_Time
column cannot be compared to aDate
- to do so you first need tocast
.period
: The period to compute the difference in. ForDate
columns it should be aDate_Period
and forTime
columns it should be aTime_Period
. ForDate_Time
columns it can be either.
Remarks
Time Zone handling
Some backends may not preserve the timezone data in a Date_Time
(preserving the represented time instant). This may lead to slight
differences in time calculations between backends, especially around
unusual events like DST.