Here is the syntax for the DateDiff function.


Syntax

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

The DateDiff function syntax has these named arguments:

Part - Description
interval - Required. String expression that is the interval of time you use to calculate the difference between date1 and date2.
date1, date2 - Required; Variant (Date). Two dates you want to use in the calculation.
firstdayofweek - Optional. A constant that specifies the first day of the week. If not specified, Sunday is assumed.
firstweekofyear - Optional. A constant that specifies the first week of the year. If not specified, the first week is assumed to be the week in which January 1 occurs.



Settings

The interval argument has these settings:

Setting - Description
yyyy - Year
q - Quarter
m - Month
y - Day of year
d - Day
w - Weekday
ww - Week
h - Hour
n - Minute
s - Second

Usage


Code:
?DateDiff("m", "11/11/11", "12/12/12")