English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

JavaScript setTime() Method

 JavaScript Date Object

The setTime() method sets the time of the date object by specifying from 1970-1-1 00:00:00 UTC start time in milliseconds to set the time of the date object, for dates earlier than 1970-1-1 00:00:00 UTC time can be represented by negative values.

Syntax:

date.setTime(millisec)
var d = new Date();
d.setTime(1542655292087);
Test See‹/›

Browser Compatibility

All browsers fully support the setTime() method:

Method
setTime()IsIsIsIsIs

Parameter Value

ParameterDescription
millisecAn integer representing the number of1970 Year1Month1Milliseconds since 00:00:00 UTC

Technical Details

Return Value:1970 Year1Month1Milliseconds between 00:00:00 UTC and the update date
JavaScript Version:ECMAScript 1

 JavaScript Date Object