/

HTML / CSS / JavaScript Tutorial

JavaScript Date method: setUTCFullYear()

[this page | pdf | back links]

The setUTCFullYear() method (when applied a JavaScript date) sets the date variable’s UTC year (and optionally its month and day).

 

It has the following syntax with the following parameters:

 

date.setUTCFullYear(year,month,day)

 

Parameter

Required / Optional

Description

year

Required

Integer (with 4 digits for years between 1000 and 9999).

month

Optional

Integer representing month of year. Typically, will be in range 0 – 11. However, -1 will result last month of previous year, 12 will result in first month of next year etc.

day

Optional

Integer representing day of month. Typically, will be in range 1 – 31. However, 0 will result in last day of previous month, -1 the day before that etc., and e.g. 32 for a 30-day month will be second day of following month

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript Dates


Desktop view | Switch to Mobile