Javascript Date setTime(milliseconds) sets the milliseconds representation of the date since January 1, 1970, 00:00:00 UTC.
dateObj.setTime(timeValue)
timeValue
- 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.
var d = new Date('July 1, 1999'); var d2 = new Date(); d2.setTime(d.getTime());// ww w.j a v a 2 s. c om console.log(d); console.log(d2);