Date.setSeconds

setSeconds – Set the seconds, according to local time (0–59).

Description

Date.setSeconds(integer seconds)

Parameters

Name Description Type Default Optional
seconds integer No

Return values

Integer. The new timestamp.

Examples

Example #1 – setSeconds example
var date = new Date(2015, 9, 21, 16, 29, 00); console.log(date.getTime()); // 1445437740000 (CEST) // 1445459340000 (EDT) console.log(date.setSeconds(10)); // 1445437750000 (CEST) // 1445459350000 (EDT) console.log(date); // 21 October 2015 16:29:10

External references