The DateDiff function in Access
In Access, you can calculate with the function DateDiff, the number of days between two date values.
- The Syntax looks like this: DateDiff(interval, date1, date2 [, firstdayofweek] [, firstweekofyear]).
- Optional entries are enclosed in square brackets.
- The round brackets are called parameters, that you need to paste in the Syntax for "Interval" are.
- It has the following options available: seconds (s), minutes (n), hours (h), weeks (ww), weekday (w), days (d), days in the year (y), months (m), quarters (q) and years (yyyy), you can.
- For example, the expression =DateDiff("m", date1, date2, 2, 2) is calculated, for example, the difference between two date values in months.
- The "m" stands for "month" and calculated the difference in months. The values of "date1" and "date2" are the necessary dates to calculate the difference.
- The last two parameters (2,2) you can use optional.
- With the first Parameter (2=firstdayofweek) and the second Parameter (2=firstweekofyear) set the first day of the week or the first week of the year.
- You can enter anything here, the first day was a Sunday and the first week, the week, the the 01.January includes.
- With the entry 2, the first day of a week is a Monday (2 = vbMonday, 3 for Tuesday, 4 for Wednesday etc.).
- In the next step you set with Parameter 2, that as the first calendar week is the first week with a minimum of 4 days in the new year.
- You want the calculation begins with the first full week of the year, enter a 3.
- You can use the DateDiff function in an expression, as well as in the VBA Code.

Structure of the DateDiff function
As a date in Access query can read in the next article.