Previous Topic: Date ChangeNext Topic: Date Offset


Date Difference

The date difference function returns the number of days between two specified dates.

Syntax:

►►─── DATEDIF (gregorian-date1, gregorian-date2) ─────────────────────────────►◄
[DATEDIFX]

Invocation names:

DATEDIF

Parameters:

gregorian-date1

Specifies the date, in Gregorian format, from which the second date is subtracted to derive the difference in days.

gregorian-date2

Specifies the date, in Gregorian format, subtracted from the first date to derive the difference in days.

Example:

This example determines the number of days between January 28, 1958, and August 11, 1955:

select datedif(580128,550811) as 'older' from table1

  OLDER = 901

Note: If the dates were supplied in reverse order, the value -901 would have been returned.