`setUTCFullYear()` 方法根据世界标准时间为一个具体日期设置年份。

The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.

## 语法

    dateObj.setUTCFullYear(yearValue[, monthValue[, dayValue]])

### 参数

`yearValue`
  指定年份整数值，例如，1995
`monthValue`
  可选。指定一个0-11之间的整数值，代表从一月到十二月。
`dayValue`
  可选。指定一个1-31之间的整数值，代表月份中的第几天。如果你指定了dayValue参数，那么你必须指定monthValue参数。

## 描述

如果你没有指定具体的`monthValue和dayValue，`将会使用 `getUTCMonth` 和`getUTCDate` 方法的返回值。

如果你指定的参数超出了期待范围，`setUTCFullYear()方法将会根据Date对象，更新其他参数和日期信息。例如，如果你将monthValue设定为15，年份会增加1，月份值则为为3。`

## 例子

### 使用 `setUTCFullYear()`

    var theBigDay = new Date();
    theBigDay.setUTCFullYear(1997);

## 规范

规范版本 | 规范状态 | 注解
--- | --- | ---
ECMAScript 1st Edition (ECMA-262) | Standard | 初始定义。 在 JavaScript 1.3实施。
ECMAScript 5.1 (ECMA-262) Date.prototype.setUTCFullYear | Standard |
ECMAScript 2015 (6th Edition, ECMA-262) Date.prototype.setUTCFullYear | Standard |
ECMAScript Latest Draft (ECMA-262) Date.prototype.setUTCFullYear | Draft |

## 浏览器兼容性

The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.

Update compatibility data on GitHub

| Desktop | Mobile | Server
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | Safari on iOS | Samsung Internet | Node.js
`setUTCFullYear` | Chrome Full support Yes | Edge Full support 12 | Firefox Full support 1 | IE Full support Yes | Opera Full support Yes | Safari Full support Yes | WebView Android Full support Yes | Chrome Android Full support Yes | Edge Mobile Full support Yes | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support Yes | nodejs Full support Yes

### Legend

Full support
  Full support

相关连接

- `Date.prototype.getUTCFullYear()`
- `Date.prototype.setFullYear()`