Visit Mozilla.org

Core JavaScript 1.5 Reference:Global Objects:Date:setTime

From MDC


Contents

[edit] Summary

Sets the Date object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC.

Method of Date
Implemented in: JavaScript 1.0, NES 2.0
ECMA Version: ECMA-262

[edit] Syntax

setTime(timeValue)

[edit] Parameters

timeValue 
An integer representing the number of milliseconds since 1 January 1970, 00:00:00 UTC.

[edit] Description

Use the setTime method to help assign a date and time to another Date object.

[edit] Examples

[edit] Example: Using setTime

theBigDay = new Date("July 1, 1999")
sameAsBigDay = new Date()
sameAsBigDay.setTime(theBigDay.getTime())

[edit] See Also

getTime, setUTCHours