| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Date/setYear | [Back] [Original] |
Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
Avoid using this feature in new projects.
The getYear() and setYear() methods use a truncated number instead of the actual year number, known as a year 2000 problem.
This feature may be a candidate for removal from web standards or browsers.
Date setYear() .
setYear() setFullYear() new Date() Date.parse() . 22 61
setYear() 1900 . date.setYear(22) 1922 date.setYear(61) 1961 . ( new Date(61, 1) 1961 new Date("2/1/22") 2022 , Date.parse() ).
setFullYear() date.setFullYear(61) 0061 , date.setFullYear(22) 0022 .
setYear() setFullYear() .
setYear(yearValue)
Date . yearValue NaN( undefined NaN ) NaN .
yearValue 0 99 , dateObj 1900 + yearValue . dateObj yearValue .
1996 . 2000 .
const theBigDay = new Date();
theBigDay.setYear(96);
theBigDay.setYear(1996);
theBigDay.setYear(2000);
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-date.prototype.setyear |
Date.prototype.setYear in core-jsDate.prototype.getFullYear()Date.prototype.getUTCFullYear()Date.prototype.setFullYear()Date.prototype.setUTCFullYear()This page was last modified on 2024 4 28 by MDN contributors.
DateDate.prototype.getDate()Date.prototype.getDay()Date.prototype.getFullYear()Date.prototype.getHours()Date.prototype.getMilliseconds()Date.prototype.getMinutes()Date.prototype.getMonth()Date.prototype.getSeconds()Date.prototype.getTime()Date.prototype.getTimezoneOffset()Date.prototype.getUTCDate()Date.prototype.getUTCDay()Date.prototype.getUTCFullYear()Date.prototype.getUTCHours()Date.prototype.getUTCMilliseconds()Date.prototype.getUTCMinutes()Date.prototype.getUTCMonth()Date.prototype.getUTCSeconds()Date.prototype.getYear()Date.prototype.setDate()Date.prototype.setFullYear()Date.prototype.setHours()Date.prototype.setMilliseconds()Date.prototype.setMinutes()Date.prototype.setMonth()Date.prototype.setSeconds()Date.prototype.setTime()Date.prototype.setUTCDate()Date.prototype.setUTCFullYear()Date.prototype.setUTCHours()Date.prototype.setUTCMilliseconds()Date.prototype.setUTCMinutes()Date.prototype.setUTCMonth()Date.prototype.setUTCSeconds()Date.prototype.setYear()Date.prototype.toDateString()Date.prototype.toISOString()Date.prototype.toJSON()Date.prototype.toLocaleDateString()Date.prototype.toLocaleString()Date.prototype.toLocaleTimeString()Date.prototype.toString()toTemporalInstant()Date.prototype.toTimeString()Date.prototype.toUTCString()Date.prototype.valueOf()Date.prototype[@@toPrimitive]Object/FunctionObject.prototype.__defineGetter__()Object.prototype.__defineSetter__()Object.prototype.__lookupGetter__()Object.prototype.__lookupSetter__()Object.prototype.hasOwnProperty()Object.prototype.isPrototypeOf()Object.prototype.propertyIsEnumerable()Object.prototype.toLocaleString()Object.prototype.toString()Object.prototype.valueOf()Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |