ES6 - setTime() Method


Advertisements


JavaScript date setTime()method sets the Date object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC.

Syntax

Date.setTime(timeValue)        

Parameter

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

Example

var dt = new Date( "Aug 28, 2008 23:30:00" ); 
dt.setTime( 5000000 ); 
console.log( dt );        

Output

Thu Jan 01 1970 06:53:20 GMT+0530 (India Standard Time)       

es6_date.htm

Advertisements