Retrieve the difference between two dates, measured in years.
SELECT DateDiff(“yyyy”, #13/01/1998#, #09/05/2017#); |
The DATEDIFF()
function computes the difference between two dates.
DateDiff(datepart, date1, date2, firstdayofweek, firstweekofyear) |
Parameter |
Description |
datepart |
Mandatory. Specifies the unit of measurement for the difference to be returned. Options include:
|
date1 and date2 |
Mandatory. Specifies the two dates used to compute the difference. |
firstdayofweek |
Optional. Specifies the first day of the week, which can be set to:
|
firstdayofyear |
Optional. Specifies the definition of the first week of the year, which can be set to:
|
WORKS IN |
From Access 2000 |
Retrieve the difference between two dates, measured in months.
SELECT DateDiff(“m”, #13/01/1998#, #09/05/2017#); |
Retrieve the difference in days between a specified date and today’s date.
SELECT DateDiff(“d”, #13/01/1998#, Date()); |