ES6 - metodo setTime ()

Il metodo JavaScript date setTime () imposta l'oggetto Date sull'ora rappresentata da un numero di millisecondi dal 1 gennaio 1970, 00:00:00 UTC.

Sintassi

Date.setTime(timeValue)

Parametro

  • timeValue - Un numero intero che rappresenta il numero di millisecondi dal 1 ° gennaio 1970, 00:00:00 UTC.

Esempio

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

Produzione

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