DateAdd()

Top  Previous  Next

DateAdd() - Change a Date by a Specified Time Interval

Description

The DateAdd() function allows you to change a date by adding to or reducing it by a specified time interval. For example, calculate the date 9 days ago.

Date = DateAdd(interval, amount, date)

Parameters
The interval is a string expression representing the type of interval to increase or decrease the date by. See the table below for possible values:

Value

Description

d

Day

m

Month

yyyy

Year

w

Weekday

y

Day of year

ww

Week of year

q

Quarter

h

Hour

n

Minute

s

Second

The amount parameter specific the number interval to increase or decrease the date by. Postive numbers increase to future dates, negative numbers decrease to past dates.

The date parameter specifies the starting date to change. This can either be a date variable or a formatted date string.

Example

NewDate = DateAdd("m", 1, "3-Feb-2000") 'returns 3-Mar-2000

 

NewDate = DateAdd("yyyy", 2, "April 7, 1999") 'returns 7-Apr-2001

 

NewDate = DateAdd("d", -9, Date()) 'returns the date 9 days ago