setTime() method sets the
Date object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
- An integer representing the number of milliseconds since 1 January 1970, 00:00:00 UTC.
The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date (effectively, the value of the argument).
setTime() method to help assign a date and time to another
var theBigDay = new Date('July 1, 1999'); var sameAsBigDay = new Date(); sameAsBigDay.setTime(theBigDay.getTime());
|ECMAScript Latest Draft (ECMA-262)
The definition of 'Date.prototype.setTime' in that specification.
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
|Chrome Full support 1||Edge Full support 12||Firefox Full support 1||IE Full support 3||Opera Full support Yes||Safari Full support 1||WebView Android Full support 1||Chrome Android Full support 18||Firefox Android Full support 4||Opera Android Full support Yes||Safari iOS Full support 1||Samsung Internet Android Full support 1.0||nodejs Full support Yes|
- Full support
- Full support