--- title: Date.prototype.getUTCFullYear() slug: Web/JavaScript/Reference/Global_Objects/Date/getUTCFullYear translation_of: Web/JavaScript/Reference/Global_Objects/Date/getUTCFullYear ---
O método getUTCFullYear() retorna o ano na data indicada de acordo com o horário universal.
dateObj.getUTCFullYear()
Um número que representa o ano na data indicada de acordo com o horário universal.
O valor retornado por getUTCFullYear() é um número absoluto compatível com ano 2000, por exemplo, 1995.
getUTCFullYear()O exemplo a seguir atribui o valor de 4 dígitos do ano atual à variável year.
var today = new Date(); var year = today.getUTCFullYear();
| Especificação | Status | Comentário |
|---|---|---|
| {{SpecName('ES1')}} | {{Spec2('ES1')}} |
Definição inicial. Implementado no JavaScript 1.3. |
| {{SpecName('ES5.1', '#sec-15.9.5.11', 'Date.prototype.getUTCFullYear')}} | {{Spec2('ES5.1')}} | |
| {{SpecName('ES6', '#sec-date.prototype.getutcfullyear', 'Date.prototype.getUTCFullYear')}} | {{Spec2('ES6')}} | |
| {{SpecName('ESDraft', '#sec-date.prototype.getutcfullyear', 'Date.prototype.getUTCFullYear')}} | {{Spec2('ESDraft')}} |
{{Compat("javascript.builtins.Date.getUTCFullYear")}}