Returns a Variant (Long) specifying the number of time intervals between two dates.

      DateDiff(interval, date1, date2[, firstdayofweek[, firstweekofyear]])

   interval  The interval of time to add.

   date1, date2    The two dates to compare Variant (Date).

   firstdayofweek  A constant (0-7)that specifies the first day of the week.
                   default=vbSunday (1).

   firstweekofyear A constant (0-3) that specifies the first week of the year.
                   default = the week in which January 1 occurs (1).
Interval Setting Description
yyyy Year
q Quarter
m Month
y Day of year
d Day
w Weekday
ww Week
h Hour
n Minute
s Second

0 vbUseSystem - Use the NLS API setting.
1 vbFirstJan1 - Start with week in which January 1 occurs (default).
2 vbFirstFourDays - Start with the first week that has at least four days in the new year.
3 vbFirstFullWeek - Start with first full week of the year.

If date1 refers to a later point in time than date2, then DateDiff() returns a negative number.
The firstdayofweek argument will affect calculations that use week intervals.
When comparing December 31 to January 1, DateDiff for Year ("yyyy") returns 1 even though only a day has elapsed.

The DateDiff() function can be used in VBA or in an SQL query.


In a query:



DateDiff("ww", "Jan 01","Feb 14")

DateDiff("d", dtmStart, dtmEnd)

“Beauty is Nature's coin, must not be hoarded, but must be current” ~ John Milton


Date - Return the current date.
- Add a time interval to a date.
- Return part of a given date.
DateSerial - Return a date given a year, month, and day.
Add WeekDays - FMS inc
Count Working Days - Access 2007

© Copyright 1999-2016
Some rights reserved