r4 - 23 Jun 2006 - 11:04:27 - MatthewEernisseYou are here: OSAF >  Documentation Web  >  ScoobyJavaScriptLibraries > JavaScriptDateAdd

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;

Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r4 < r3 < r2 < r1 | More topic actions
 
Open Source Applications Foundation
Except where otherwise noted, this site and its content are licensed by OSAF under an Creative Commons License, Attribution Only 3.0.
See list of page contributors for attributions.