MS Access DateAdd() Function

The DateAdd() function in MS Access is used to add or subtract a specified time interval to or from a date value. This is a powerful tool for date manipulation and calculating future or past dates.



DateAdd(): Definition and Usage

DateAdd() allows you to easily adjust dates by adding or subtracting various time units like years, months, days, hours, minutes, and seconds. This function is extremely useful for tasks like calculating deadlines, anniversaries, or analyzing data based on time periods.

Syntax

Syntax

DateAdd(interval, number, date)
      

Parameter Values

Parameter Description
interval The time/date interval to add. Options:
  • yyyy: Year
  • q: Quarter
  • m: Month
  • y: Day of year
  • d: Day
  • w: Weekday
  • ww: Week
  • h: Hour
  • n: Minute
  • s: Second
This is required.
number The number of intervals to add. Positive numbers add to the date, negative numbers subtract. This is required.
date The starting date. This is required.

Examples

Adding Two Years to a Date

Adding two years to November 22nd, 2017.

Syntax

SELECT DateAdd("yyyy", 2, #22/11/2017#);
      
Output

22/11/2019 (or a similar date format depending on your regional settings)
      

Adding One Year to Today's Date

Adding one year to the current date.

Syntax

SELECT DateAdd("yyyy", 1, Date());
      
Output

(Today's date plus one year, in your system's date format)
      

Adding Six Months to Birth Dates

This example adds six months to each employee's birth date (assuming an 'Employees' table with a 'BirthDate' and 'LastName' column).

Syntax

SELECT LastName, DateAdd("m", 6, BirthDate) FROM Employees;
      
Output

LastName | Calculated Date
--------------------------
...       | ...
      

**Note:** The output for the last example will depend on the data in your `Employees` table. The date format will also match your system's regional settings.