Date.add
Library
date.js
Syntax
dt.add(interval, number); (where dt is a JavaScript Date object)
Parameters
interval A string that is the interval you want to add.
number An integer for the number of interval you want to add. Passing a negative number will decrement the date (i.e., give you a date in the past).
Description
Returns a date to which a specified time interval has been added.
Interval
The interval string may be in the following units:
yyyy - Year
q -- Quarter
m -- Month
y -- Day of year
d -- Day
w -- Weekday
ww -- Week of year
h -- Hour
n -- Minute
s -- Second
Examples
The example below will return a date of 12/27/1978.
var dt = new Date('12/27/1968');
dt.add('yyyyy', 10);
return dt;