Skip to main content

DB_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. a Date_Time column cannot be compared to a Date - to do so you first need to cast.
  • period: The period to compute the difference in. For Date columns it should be a Date_Period and for Time columns it should be a Time_Period. For Date_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.