From da78a9e329e272dedb2400b79a3bdeebff387d47 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:17 -0500 Subject: initial commit --- .../global_objects/date/getfullyear/index.html | 84 ++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 files/it/web/javascript/reference/global_objects/date/getfullyear/index.html (limited to 'files/it/web/javascript/reference/global_objects/date/getfullyear/index.html') diff --git a/files/it/web/javascript/reference/global_objects/date/getfullyear/index.html b/files/it/web/javascript/reference/global_objects/date/getfullyear/index.html new file mode 100644 index 0000000000..57d1c5efc7 --- /dev/null +++ b/files/it/web/javascript/reference/global_objects/date/getfullyear/index.html @@ -0,0 +1,84 @@ +--- +title: Date.prototype.getFullYear() +slug: Web/JavaScript/Reference/Global_Objects/Date/getFullYear +translation_of: Web/JavaScript/Reference/Global_Objects/Date/getFullYear +--- +
{{JSRef}}
+ +

 

+ +

Il metodo  getFullYear() restituisce l'anno della data specificata in accordo con l'ora locale.

+ +

Utilizza questo metodo invece di quello {{jsxref("Date.prototype.getYear()", "getYear()")}}.

+ +
{{EmbedInteractiveExample("pages/js/date-getfullyear.html")}}
+ + + +

Sintassi

+ +
dateObj.getFullYear()
+ +

Valore di ritorno

+ +

Un numero corrispondente all'anno della data fornita, in accordo con l'ora locale.

+ +

Descrizione

+ +

Il valore restituito da getFullYear() è un numero assoluto. Per le date tra gli anni 1000 e 9999, getFullYear() restituisce un numero a 4 cifre, per esempio, 1995. Usa quetsa funzione per essere sicuro che un anno sia compiacente con gli anni dopo il 2000.

+ +

Esempi

+ +

Utilizzando getFullYear()

+ +

Il seguente esempio assegna il valore a quattro cifre dell'anno corrente alla variabile year.

+ +
var today = new Date();
+var year = today.getFullYear();
+
+ +

Specificazioni

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('ES1')}}{{Spec2('ES1')}}Definizione iniziale. Implementata in JavaScript 1.3.
{{SpecName('ES5.1', '#sec-15.9.5.10', 'Date.prototype.getFullYear')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.getfullyear', 'Date.prototype.getFullYear')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-date.prototype.getfullyear', 'Date.prototype.getFullYear')}}{{Spec2('ESDraft')}} 
+ +

Compatibilità Browser

+ + + +

{{Compat("javascript.builtins.Date.getFullYear")}}

+ +

Vedere anche

+ + -- cgit v1.2.3-54-g00ecf