DateAdd

Add a specified time interval to a date.

Syntax
      DateAdd(interval, number, date)

Key
   interval  The interval of time to add.

   number    The number of intervals to add.
             positive for dates in the future or
             negative for dates in the past.

   date      The  date to which the interval is added.
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

DateAdd won't return an invalid date.

The DateAdd() function may be used in VBA or in an SQL query.

Example

Add one month to January 31:

DateAdd("m", 1, "31-Jan-12")

In this case, DateAdd returns 29-Feb-12

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

Related:

Date - Return the current date.
DateDiff - Return the time difference between two dates.
DatePart - Return part of a given date.
DateSerial - Return a date given a year, month, and day.


© Copyright SS64.com 1999-2013
Some rights reserved