English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Méthode setUTCFullYear() de JavaScript

 JavaScript Date Object

setUTCFullYear()Définir l'année dans l'objet Date en fonction de l'heure universelle (quatre chiffres).

Cette méthode peut également être utilisée pour définir le mois et le mois.

Si les paramètres spécifiés dépassent les attentes, alorssetUTCFullYear() vaessayez de mettre à jour les autres paramètres et les informations de date de l'objet Date de manière correspondante.

Par exemple, si vous avezmonth(mois)valeur spécifiée16 ,alors l'année augmentera1(valeur de l'année+ 1),et le mois utilisera4.

L'heure universelle coordinée (UTC) est l'heure du temps universel standardisé.

Syntaxe :

date.setUTCFullYear(year, month, day)
var d = new Date();
d.setUTCFullYear(2010);
Test See‹/›

Si aucune valeur n'est spécifiéemonthanddayIf the parameter is not specified, use the values returned by the getUTCMonth() and getUTCDate() methods.

Browser Compatibility

All browsers fully support the setUTCFullYear() method:

Method
setUTCFullYear()isisisisis

Parameter Value

ParameterDescription
year(Required) An integer specifying the numeric value of the year, for example1992
month(Optional) 0 to11indicating January to December
day(Optional) an integer between1to31is an integer between the two, indicating the day of the month.
Note:If specifieddayIf the parameter is specified, it must also be specifiedmonthParameters.

Technical Details

Return Value:1970 years1Month1Milliseconds between 00:00:00 UTC and the update date
JavaScript Version:ECMAScript 1

More Examples

Specify16As the month value:

var d = new Date();
d.setUTCFullYear(2010, 16);
Test See‹/›

 JavaScript Date Object