English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
DassetFullYear()Method, sets the full year (four-digit year is four digits) for the specified date object according to the local time.
This method can also be used to set the month and day of the month.
If the specified parameters are out of the expected range, thensetFullYear()Try to update other parameters and date information in the Date object accordingly.
For example, if you setmonthValue specification16 ,则年份将增加1(年份值+ 1),而月份将使用4.
date.setFullYear(year, month, day)
var d = new Date(); d.setFullYear(2010);Testen Sie heraus‹/›
If not specifiedmonthanddayParameter, then use the values returned by getMonth() and getDate() methods.
setFullYear()-Methode wird von allen Browsern vollständig unterstützt:
Methode | |||||
setFullYear() | ist | ist | ist | ist | ist |
Parameter | Beschreibung |
---|---|
year | Erforderlich) eine Ganzzahl, die den Wert des Jahres angibt, z.B.1992 |
month | Optional) eine Ganzzahl zwischen11bis |
day | Optional) eine Ganzzahl zwischen1bis31eine Ganzzahl zwischen Hinweis:wenn spezifiziertdayParameter, dann muss auchmonthParameter. |
Rückgabewert: | 1970 Jahren1Monat1Millisekunden zwischen dem Datum 00:00:00 UTC und dem Aktualisierungsdatum |
---|---|
JavaScript-Version: | ECMAScript 1 |
bestimmen16als Monatswert:
var d = new Date(); d.setFullYear(2010, 16);Testen Sie heraus‹/›
DasAufruf von setFullYear()Methoden können den Monat und das Datum festlegen:
var d = new Date(); d.setFullYear(2010, 8, 30);Testen Sie heraus‹/›