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

Date.diff

Library

date.js

Syntax

Date.diff(interval, date1, date2);

Parameters

interval A string that is the interval you want to use to calculate the differences between the two dates.

date1, date2 Two JavaScript Date objects to compare..

Description

Returns the number of intervals between two dates.

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 value of 9.

var dt1 = new Date('01/01/2112');
var dt2 = new Date('10/01/2112');
return Date.diff('m', dt1, dt2);
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.