Syntax

JSV_dateCompare(expD1, expD2)

Prototype

expD1.dateCompare(expD2)

Returns

Performs a comparison of two dates. Returns a negative one number if expD1 is less than expD2; 0 if expD1 is equal to expD2; or a positive one if expD1 is greater than expD2.

Parameters

The dateCompare function uses the following arguments.

Argument Description
expD1 Date object to be compared.
expD2 Date object to be compared.

Remarks

n/a

Dependencies

n/a

Example

The following lines of code

var d1 = new Date(1995,11,17);
var d2 = new Date(2002,11,17);
var d3 = new Date(2002,11,17);
document.write( "D1 less than D2 produces a negative one: " + d1.dateCompare(d2) );
document.write( "D2 greater than D1 produces a positive one: " + d2.dateCompare(d1) );
document.write( "D2 equal to D3 produces a zero: " + d2.dateCompare(d3) );

produce