Date.setDate

setDate – Set the day of the month, according to local time (1–31).

Description

Date.setDate(integer day)

Parameters

Name Description Type Default Optional
day integer No

Return values

Integer. The new timestamp.

Examples

Example #1 – setDate example
var date = new Date(2015, 9, 21, 16, 29, 00); console.log(date.getTime()); // 1445437740000 (CEST) // 1445459340000 (EDT) console.log(date.setDate(1)); // 1443709740000 (CEST) // 1443731340000 (EDT) console.log(date); // 01 October 2015 16:29:00

External references