Date.setTime

setTime – Set the number of milliseconds since 1 Jan 1970.

Description

Date.setTime(integer timestamp)

Parameters

Name Description Type Default Optional
timestamp integer No

Return values

Integer. The new timestamp.

Examples

Example #1 – setTime example
var date = new Date(2015, 9, 21, 16, 29, 00); console.log(date.getTime()); // 1445437740000 (CEST) // 1445459340000 (EDT) console.log(date.setTime(10000)); // 10000 console.log(date); // 01 January 1970 01:00:10 (CET) // 31 December 1969 19:00:10 (EST)

External references