[Contents] [Previous] [Next] [Index]

Number

Converts the specified object to a number.

Core function

Implemented in

Navigator 4.0, Netscape Server 3.0

Syntax

Number(obj)

Parameter

obj
An object

Description

When the object is a Date object, Number returns a value in milliseconds measured from 01 January, 1970 UTC (GMT), positive after this date, negative before.

If obj is a string that does not contain a well-formed numeric literal, Number returns NaN.

Example

The following example converts the Date object to a numerical value:

<SCRIPT>
d = new Date ("December 17, 1995 03:24:00"); 
document.write (Number(d) + "<BR>");
</SCRIPT>
This prints "819199440000."

See also

Number


[Contents] [Previous] [Next] [Index]

Last Updated: 10/31/97 16:38:00


Copyright © 1997 Netscape Communications Corporation