Date.setMonth

setMonth – Set the month, according to local time (0–11).

Description

Date.setMonth(integer month)

Parameters

Name Description Type Default Optional
month integer No

Return values

Integer. The new timestamp.

Examples

Example #1 – setMonth example
var date = new Date(2015, 9, 21, 16, 29, 00); console.log(date.getTime()); // 1445437740000 (CEST) // 1445459340000 (EDT) console.log(date.setMonth(10)); // 1448119740000 (CEST) // 1448141340000 (EDT) console.log(date); // 21 November 2015 16:29:00

External references