Date.setFullYear

setFullYear – Set the year, according to local time (four digits).

Description

Date.setFullYear(integer year)

Parameters

Name Description Type Default Optional
year integer No

Return values

Integer. The new timestamp.

Examples

Example #1 – setFullYear example
var date = new Date(2015, 9, 21, 16, 29, 00); console.log(date.getTime()); // 1445437740000 (CEST) // 1445459340000 (EDT) console.log(date.setFullYear(2000)); // 972138540000 (CEST) // 972160140000 (EDT) console.log(date); // 21 October 2000 16:29:00

External references