From 4b1a9203c547c019fc5398082ae19a3f3d4c3efe Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:41:15 -0500 Subject: initial commit --- .../objectes_globals/date/setfullyear/index.html | 128 +++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 files/ca/web/javascript/referencia/objectes_globals/date/setfullyear/index.html (limited to 'files/ca/web/javascript/referencia/objectes_globals/date/setfullyear') diff --git a/files/ca/web/javascript/referencia/objectes_globals/date/setfullyear/index.html b/files/ca/web/javascript/referencia/objectes_globals/date/setfullyear/index.html new file mode 100644 index 0000000000..c29d56ca4e --- /dev/null +++ b/files/ca/web/javascript/referencia/objectes_globals/date/setfullyear/index.html @@ -0,0 +1,128 @@ +--- +title: Date.prototype.setFullYear() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/setFullYear +translation_of: Web/JavaScript/Reference/Global_Objects/Date/setFullYear +--- +
{{JSRef}}
+ +

El mètode setFullYear() assigna l'any sencerr per a la data especificada, d'acord a l'hora local. Retorna una nova marca de temps.

+ +

Sintaxi

+ +
objecteData.setFullYear(any[, mes[, dia]])
+ +

Paràmetres

+ +
+
any
+
Un nombre sencer que representa el valor numèric de l'any, per exemple, 1995.
+
mes
+
Un nombre sencer entre 0 i 11 que representa el mes.
+
dia
+
Opcional. Un nombre sencer entre 1 i 31 que representa el dia del mes.
+
+ +

Valor retornat

+ +

Una nova marca de temps amb el valor de l'objecte actual.

+ +

Descripció

+ +

Si no s'especifica el paràmetre dia s'utilitza el valor retornat pels mètodes {{jsxref("Date.prototype.getMonth()", "getMonth()")}} i {{jsxref("Date.prototype.getDate()", "getDate()")}}.

+ +

Si es passa un paràmetre que està fora del rang esperat, el mètode UTC() actualitza els altres paràmetres per a acceptar el nombre. Per exemple, si es passa 15 com a mes, l'any serà incrementat en 1 (any + 1), i s'emprarà 3 com a mes.

+ +

Exemples

+ +

Utilitzar setFullYear()

+ +
var elGranDia = new Date();
+elGranDia.setFullYear(1997);
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.3.
{{SpecName('ES5.1', '#sec-15.9.5.40', 'Date.prototype.setFullYear')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.setfullyear', 'Date.prototype.setFullYear')}}{{Spec2('ES6')}} 
+ +

Compatibilitat amb navegadors

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +

Vegeu també

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