From cb9e359a51c3249d8f5157db69d43fd413ddeda6 Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 14:45:12 +0100 Subject: unslug ca: move --- .../global_objects/date/getdate/index.html | 119 ++++++++++ .../global_objects/date/getday/index.html | 121 ++++++++++ .../global_objects/date/getfullyear/index.html | 121 ++++++++++ .../global_objects/date/gethours/index.html | 120 ++++++++++ .../global_objects/date/getmilliseconds/index.html | 118 ++++++++++ .../global_objects/date/getminutes/index.html | 120 ++++++++++ .../global_objects/date/getmonth/index.html | 120 ++++++++++ .../global_objects/date/getseconds/index.html | 120 ++++++++++ .../global_objects/date/gettime/index.html | 135 +++++++++++ .../date/gettimezoneoffset/index.html | 109 +++++++++ .../global_objects/date/getutcdate/index.html | 119 ++++++++++ .../global_objects/date/getutcday/index.html | 119 ++++++++++ .../global_objects/date/getutcfullyear/index.html | 118 ++++++++++ .../global_objects/date/getutchours/index.html | 118 ++++++++++ .../date/getutcmilliseconds/index.html | 116 ++++++++++ .../global_objects/date/getutcminutes/index.html | 116 ++++++++++ .../global_objects/date/getutcmonth/index.html | 116 ++++++++++ .../global_objects/date/getutcseconds/index.html | 118 ++++++++++ .../global_objects/date/getyear/index.html | 162 +++++++++++++ .../reference/global_objects/date/index.html | 250 +++++++++++++++++++++ .../reference/global_objects/date/now/index.html | 126 +++++++++++ .../global_objects/date/setdate/index.html | 122 ++++++++++ .../global_objects/date/setfullyear/index.html | 128 +++++++++++ .../global_objects/date/sethours/index.html | 129 +++++++++++ .../global_objects/date/setmilliseconds/index.html | 117 ++++++++++ .../global_objects/date/setminutes/index.html | 127 +++++++++++ .../global_objects/date/setmonth/index.html | 126 +++++++++++ .../global_objects/date/setseconds/index.html | 125 +++++++++++ .../global_objects/date/settime/index.html | 118 ++++++++++ .../global_objects/date/setutcdate/index.html | 119 ++++++++++ .../global_objects/date/setutcfullyear/index.html | 123 ++++++++++ .../global_objects/date/setutchours/index.html | 125 +++++++++++ .../date/setutcmilliseconds/index.html | 117 ++++++++++ .../global_objects/date/setutcminutes/index.html | 123 ++++++++++ .../global_objects/date/setutcmonth/index.html | 121 ++++++++++ .../global_objects/date/setutcseconds/index.html | 121 ++++++++++ .../global_objects/date/setyear/index.html | 124 ++++++++++ .../global_objects/date/todatestring/index.html | 115 ++++++++++ .../global_objects/date/togmtstring/index.html | 115 ++++++++++ .../global_objects/date/toisostring/index.html | 134 +++++++++++ .../global_objects/date/tojson/index.html | 108 +++++++++ .../global_objects/date/tostring/index.html | 142 ++++++++++++ .../global_objects/date/totimestring/index.html | 115 ++++++++++ .../reference/global_objects/date/utc/index.html | 142 ++++++++++++ .../global_objects/date/valueof/index.html | 118 ++++++++++ 45 files changed, 5635 insertions(+) create mode 100644 files/ca/web/javascript/reference/global_objects/date/getdate/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/getday/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/getfullyear/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/gethours/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/getmilliseconds/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/getminutes/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/getmonth/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/getseconds/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/gettime/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/gettimezoneoffset/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/getutcdate/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/getutcday/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/getutcfullyear/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/getutchours/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/getutcmilliseconds/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/getutcminutes/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/getutcmonth/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/getutcseconds/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/getyear/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/now/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/setdate/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/setfullyear/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/sethours/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/setmilliseconds/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/setminutes/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/setmonth/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/setseconds/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/settime/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/setutcdate/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/setutcfullyear/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/setutchours/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/setutcmilliseconds/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/setutcminutes/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/setutcmonth/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/setutcseconds/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/setyear/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/todatestring/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/togmtstring/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/toisostring/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/tojson/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/tostring/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/totimestring/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/utc/index.html create mode 100644 files/ca/web/javascript/reference/global_objects/date/valueof/index.html (limited to 'files/ca/web/javascript/reference/global_objects/date') diff --git a/files/ca/web/javascript/reference/global_objects/date/getdate/index.html b/files/ca/web/javascript/reference/global_objects/date/getdate/index.html new file mode 100644 index 0000000000..16808aaae0 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/getdate/index.html @@ -0,0 +1,119 @@ +--- +title: Date.prototype.getDate() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/getDate +translation_of: Web/JavaScript/Reference/Global_Objects/Date/getDate +--- +
{{JSRef}}
+ +

El mètode getDate() retorna el dia del mes per a la data especificada segons l'hora local.

+ +

Sintaxi

+ +
objecteData.getDate()
+ +

Paràmetres

+ +

Cap.

+ +

Valor retornat

+ +

El valor retornat per getDate() és un nombre sencer entre 1 i 31.

+ +

Exemples

+ +

Utilitzar getDate()

+ +

La segona sentència de l'exemple de sota assigna el valor 25 a la variable dia, basant-se en el valor de l'objecte {{jsxref("Date")}} nadal95.

+ +
var nadal95 = new Date('December 25, 1995 23:15:30');
+var dia = nadal95.getDate();
+
+console.log(dia); // 25
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES6', '#sec-date.prototype.getdate', 'Date.prototype.getDate')}}{{Spec2('ES6')}} 
{{SpecName('ES5.1', '#sec-15.9.5.14', 'Date.prototype.getDate')}}{{Spec2('ES5.1')}} 
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.1.
+ +

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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/getday/index.html b/files/ca/web/javascript/reference/global_objects/date/getday/index.html new file mode 100644 index 0000000000..244562c167 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/getday/index.html @@ -0,0 +1,121 @@ +--- +title: Date.prototype.getDay() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/getDay +translation_of: Web/JavaScript/Reference/Global_Objects/Date/getDay +--- +
{{JSRef("Global_Objects", "Date")}}
+ +

Resum

+ +

El mètode getDay() retorna el dia de la setmana per a la data especificada, en temps local on 0 (zero) representa el Diumenge.

+ +

Sintaxi

+ +
dateObj.getDay()
+ +

Paràmetres

+ +

Cap.

+ +

Retorna

+ +

El valor retornat per getDay() és un nombre sencer que correspon al dia de la setmana tal i com es mostra a continuació: 0 és Diumenge, 1 és Dilluns, 2 és Dimarts, etcètera.

+ +

Exemples

+ +

Exemple: Utilitzar getDay()

+ +

La segona sentència que trobareu a continuació asigna el valor 1 a la variable diaSetmana, basat en el valor de l'objecte {{jsxref("Global_Objects/Date", "Date")}} nadal95, que està inicialitzat amb la data d 25 de Desembre de 1995, és un Dilluns.

+ +
var nadal95 = new Date('December 25, 1995 23:15:30');
+var diaSetmana = nadal95.getDay();
+
+console.log(diaSetmana); // 1
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.9.5.16', 'Date.prototype.getDay')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.getday', 'Date.prototype.getDay')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/getfullyear/index.html b/files/ca/web/javascript/reference/global_objects/date/getfullyear/index.html new file mode 100644 index 0000000000..94f14f4332 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/getfullyear/index.html @@ -0,0 +1,121 @@ +--- +title: Date.prototype.getFullYear() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/getFullYear +translation_of: Web/JavaScript/Reference/Global_Objects/Date/getFullYear +--- +
{{JSRef("Global_Objects", "Date")}}
+ +

Resum

+ +

El mètode getFullYear() retorna l'any de la data especificada, en temps local.

+ +

Utilitzeu aquest mètode en comptes de {{jsxref("Date.prototype.getYear()", "getYear()")}}.

+ +

Sintaxi

+ +
dateObj.getFullYear()
+ +

Paràmetres

+ +

Cap.

+ +

Retorna

+ +

El valor retornat per getFullYear() és un nombre absolut. Per a dates entre els anys 1000 i 9999, getFullYear() retorna un nombre de 4 dígits (1995, per exemple). Utilitzeu aquesta funció per a assegurar-vos d'obtindre un any compatible amb l'efecte 2000.

+ +

Exemples

+ +

Exemple: Utilitzar getFullYear()

+ +

L'exemple següent assigna el valor de 4 dígits de l'any actual a la variable any.

+ +
var avui = new Date();
+var any = avui.getFullYear();
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a 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')}} 
+ +

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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/gethours/index.html b/files/ca/web/javascript/reference/global_objects/date/gethours/index.html new file mode 100644 index 0000000000..3848e96339 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/gethours/index.html @@ -0,0 +1,120 @@ +--- +title: Date.prototype.getHours() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/getHours +translation_of: Web/JavaScript/Reference/Global_Objects/Date/getHours +--- +
{{JSRef("Global_Objects", "Date")}}
+ +

Resum

+ +

El mètode getHours() retorna l'hora per a la data especificada, en temps local.

+ +

Sintaxi

+ +
dateObj.getHours()
+ +

Paràmetres

+ +

Cap.

+ +

Retorna

+ +

El valor retornat per getHours() és un nombre sencer entre 0 i 23.

+ +

Exemples

+ +

Exemple: Utilitzar getHours()

+ +

La segona sentència que trobareu a continuació assigna el valor 23 a la variable hora, basant-se en l'objecte {{jsxref("Global_Objects/Date", "Date")}} nadal95.

+ +
var nadal95 = new Date('December 25, 1995 23:15:30');
+var hora = nadal95.getHours();
+
+console.log(hora); // 23
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.9.5.18', 'Date.prototype.getHours')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.gethours', 'Date.prototype.getHours')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/getmilliseconds/index.html b/files/ca/web/javascript/reference/global_objects/date/getmilliseconds/index.html new file mode 100644 index 0000000000..d438cf8cad --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/getmilliseconds/index.html @@ -0,0 +1,118 @@ +--- +title: Date.prototype.getMilliseconds() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/getMilliseconds +translation_of: Web/JavaScript/Reference/Global_Objects/Date/getMilliseconds +--- +
{{JSRef("Global_Objects", "Date")}}
+ +

Resum

+ +

El mètode getMilliseconds() retorna els milisegons de la data especificada d'acord a l'hora local.

+ +

Sintaxi

+ +
dateObj.getMilliseconds()
+ +

Paràmetres

+ +

Cap.

+ +

Retorna

+ +

El valor retornat per getMilliseconds() és un nombre entre 0 i 999.

+ +

Exemples

+ +

Exemple: Utilitzar getMilliseconds()

+ +

L'exemple següent assigna la part de milisegons de l'hora actual a la variable milisegons:

+ +
var avui = new Date();
+var milisegonds = avui.getMilliseconds();
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a JavaScript 1.3.
{{SpecName('ES5.1', '#sec-15.9.5.24', 'Date.prototype.getMilliseconds')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.getmilliseconds', 'Date.prototype.getMilliseconds')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/getminutes/index.html b/files/ca/web/javascript/reference/global_objects/date/getminutes/index.html new file mode 100644 index 0000000000..3ae466d56d --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/getminutes/index.html @@ -0,0 +1,120 @@ +--- +title: Date.prototype.getMinutes() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/getMinutes +translation_of: Web/JavaScript/Reference/Global_Objects/Date/getMinutes +--- +
{{JSRef("Global_Objects", "Date")}}
+ +

Resum

+ +

El mètode getMinutes() retorna els minuts de la data especificada segons el temps local.

+ +

Sintaxi

+ +
dateObj.getMinutes()
+ +

Paràmetres

+ +

Cap.

+ +

Retorna

+ +

El valor retorna per getMinutes() és un nombre sencer entre 0 i 59.

+ +

Exemples

+ +

Exemple: Utilitzar getMinutes()

+ +

La segona sentència de  sota assigna el valor 15 a la variable minuts, prenent el valor de l'objecte nadal95 de tipus {{jsxref("Global_Objects/Date", "Date")}}.

+ +
var nadal95 = new Date('December 25, 1995 23:15:30');
+var minuts = nadal95.getMinutes();
+
+console.log(minuts); // 15
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.9.5.20', 'Date.prototype.getMinutes')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.getminutes', 'Date.prototype.getMinutes')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/getmonth/index.html b/files/ca/web/javascript/reference/global_objects/date/getmonth/index.html new file mode 100644 index 0000000000..2631ebef9a --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/getmonth/index.html @@ -0,0 +1,120 @@ +--- +title: Date.prototype.getMonth() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/getMonth +translation_of: Web/JavaScript/Reference/Global_Objects/Date/getMonth +--- +
{{JSRef("Global_Objects", "Date")}}
+ +

Resum

+ +

El mètode getMonth() retorna el mes de la data especificada d'acord al temps local, representat per un nombre a partir de zero (on zero indica el primer mes de l'any).

+ +

Sintaxi

+ +
dateObj.getMonth()
+ +

Paràmetres

+ +

Cap.

+ +

Retorna

+ +

El valor retornat per getMonth() és un nombre sencer entre 0 i 11. 0 correspon a gener, 1 a febrer, etcètera.

+ +

Exemples

+ +

Exemple: Utilitzar getMonth()

+ +

La segona sentència de sota assigna el valor 11 a la variable mes, basada en el valor de l'objecte nadal95 de tipus {{jsxref("Global_Objects/Date", "Date")}}.

+ +
var nadal95 = new Date('December 25, 1995 23:15:30');
+var mes = nadal95.getMonth();
+
+console.log(mes); // 11
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.9.5.12', 'Date.prototype.getMonth')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.getmonth', 'Date.prototype.getMonth')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/getseconds/index.html b/files/ca/web/javascript/reference/global_objects/date/getseconds/index.html new file mode 100644 index 0000000000..790c62e3e9 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/getseconds/index.html @@ -0,0 +1,120 @@ +--- +title: Date.prototype.getSeconds() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/getSeconds +translation_of: Web/JavaScript/Reference/Global_Objects/Date/getSeconds +--- +
{{JSRef("Global_Objects", "Date")}}
+ +

Resum

+ +

El mètode getSeconds() retorna els segons de la data especficada d'acord al temps local.

+ +

Sintaxi

+ +
dateObj.getSeconds()
+ +

Paràmetres

+ +

Cap.

+ +

Retorna

+ +

El valor retornat per getSeconds() és un sencer entre 0 i 59.

+ +

Exemples

+ +

Exemple: Utilitzar getSeconds()

+ +

La segona sentència de sota assigna el valor 30 a la variable segons, basat en el valor de l'objecte nadal95, de tipus {{jsxref("Global_Objects/Date", "Date")}}.

+ +
var nadal95 = new Date('December 25, 1995 23:15:30');
+var segons = nadal95.getSeconds();
+
+console.log(segons); // 30
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.9.5.22', 'Date.prototype.getSeconds')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.getseconds', 'Date.prototype.getSeconds')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/gettime/index.html b/files/ca/web/javascript/reference/global_objects/date/gettime/index.html new file mode 100644 index 0000000000..20c45f31c5 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/gettime/index.html @@ -0,0 +1,135 @@ +--- +title: Date.prototype.getTime() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/getTime +translation_of: Web/JavaScript/Reference/Global_Objects/Date/getTime +--- +
{{JSRef}}
+ +

El mètode getTime() retorna el valor numèric corresponent a l'hora per a la data especificada, d'acord al temps universal.

+ +

Es pot emprar aquest mètode com a ajuda per a proporcionar una data i hora per a un altre objecte de tipus {{jsxref("Global_Objects/Date", "Date")}}. Aquest mètode és funcionalment equivalnet al mètode {{jsxref("Date.valueof", "valueOf()")}}.

+ +

Sintaxi

+ +
dateObj.getTime()
+ +

Paràmetres

+ +

Cap.

+ +

Retorn

+ +

El valor retornat pel mètode getTime() és el nombre de milisegons que han passat des de l'1 de gener de 1970 00:00:00 UTC.

+ +

Exemples

+ +

Utilitzar getTime() per a obtindre dates

+ +

Construïr un objecte date que representi el mateix moment.

+ +
var aniversari = new Date(1994, 12, 10);
+var copia= new Date();
+copia.setTime(aniversari.getTime());
+
+ +

Mesurar el temps d'execució

+ +

Restar dos crides seguides de getTime() en objectes {{jsxref("Date")}} acabats de generar dóne el temps transcorregut entre les dues crides. Això pot ser emprat per a calcular el temps d'execució d'algunes operacions. Vegeu també {{jsxref("Date.now()")}} per a prevenir l'instanciació d'objectes {{jsxref("Date")}} innecesaris.

+ +
var fi, inici;
+
+inici= new Date();
+for (var i = 0; i < 1000; i++) {
+  Math.sqrt(i);
+}
+fi = new Date();
+
+console.log("L'operació ha trigat " + (fi.getTime() - inici.getTime()) + ' ms');
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.9.5.9', 'Date.prototype.getTime')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.gettime', 'Date.prototype.getTime')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/gettimezoneoffset/index.html b/files/ca/web/javascript/reference/global_objects/date/gettimezoneoffset/index.html new file mode 100644 index 0000000000..8af4d6e9e8 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/gettimezoneoffset/index.html @@ -0,0 +1,109 @@ +--- +title: Date.prototype.getTimezoneOffset() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/getTimezoneOffset +translation_of: Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset +--- +
{{JSRef("Global_Objects", "Date")}}
+ +

Resum

+ +

El mètode getTimezoneOffset() retorna la desviació de la zona horària a l'hora UTC, en minuts, per a la localizació en ús.

+ +

Sintaxi

+ +
dateObj.getTimezoneOffset()
+ +

Paràmetres

+ +

Cap.

+ +

Retorn

+ +

La desviació de la zona horària és la diferència, en minuts, entre UTC i l'hora local. Això comporta que la desviació serà positiva si l'hora local està per darrere de la UTC i negativa si està endevant. Per exemple, si la vostra zona horària és UTC+10 (Australian Eastern Standard Time), el mètode retornarà -600. L'horari d'estalvi d'energia (d'estiu) fa que aquest valor no sigui una constant, per a qualsevol localització.

+ +

Exemples

+ +

Exemple: Utilitzar getTimezoneOffset()

+ +
var x = new Date();
+var currentTimeZoneOffsetInHours = x.getTimezoneOffset() / 60;
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.9.5.26', 'Date.prototype.getTimezoneOffset')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.gettimezoneoffset', 'Date.prototype.getTimezoneOffset')}}{{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}}
+
diff --git a/files/ca/web/javascript/reference/global_objects/date/getutcdate/index.html b/files/ca/web/javascript/reference/global_objects/date/getutcdate/index.html new file mode 100644 index 0000000000..ee3a8b881f --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/getutcdate/index.html @@ -0,0 +1,119 @@ +--- +title: Date.prototype.getUTCDate() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/getUTCDate +translation_of: Web/JavaScript/Reference/Global_Objects/Date/getUTCDate +--- +
{{JSRef("Global_Objects", "Date")}}
+ +

Resum

+ +

El mètode getUTCDate()retorna el dia del mes per a la data especificada, segons l'hora universal.

+ +

Sintaxi

+ +
dateObj.getUTCDate()
+ +

Paràmetres

+ +

Cap.

+ +

Retorn

+ +

El valor retornat per getUTCDate() és un nombre sencer entre 1 i 31.

+ +

Exemples

+ +

Exemple: Utilitzar getUTCDate()

+ +

L'exemple següent assigna la part del dia de la data actual a la variable dia.

+ +
var avui = new Date();
+var dia = avui.getUTCDate();
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a JavaScript 1.3.
{{SpecName('ES5.1', '#sec-15.9.5.15', 'Date.prototype.getUTCDate')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.getutcdate', 'Date.prototype.getUTCDate')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/getutcday/index.html b/files/ca/web/javascript/reference/global_objects/date/getutcday/index.html new file mode 100644 index 0000000000..b6f992f9a1 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/getutcday/index.html @@ -0,0 +1,119 @@ +--- +title: Date.prototype.getUTCDay() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/getUTCDay +translation_of: Web/JavaScript/Reference/Global_Objects/Date/getUTCDay +--- +
{{JSRef("Global_Objects", "Date")}}
+ +

Resum

+ +

El mètode getUTCDay() retorna el dia de la setmana de la data especificada segons l'hora universal, on 0 representa Diumenge.

+ +

Sintaxi

+ +
dateObj.getUTCDay()
+ +

Paràmetres

+ +

Cap.

+ +

Retorn

+ +

El valor retornat per  getUTCDay() és un nombre sencer que correspón al dia de la setmana: 0 per a Diumenge, 1 per a dilluns, 2 per a Dimarts, etcètera.

+ +

Exemples

+ +

Exemple: Utilitzar getUTCDay()

+ +

L'exemple següent assigna el dia de la setmana de la data actual a la variable diaSetmana.

+ +
var avui = new Date();
+var diaSetmana = avui.getUTCDay();
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a JavaScript 1.3.
{{SpecName('ES5.1', '#sec-15.9.5.17', 'Date.prototype.getUTCDay')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.getutcday', 'Date.prototype.getUTCDay')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/getutcfullyear/index.html b/files/ca/web/javascript/reference/global_objects/date/getutcfullyear/index.html new file mode 100644 index 0000000000..3ca1526e28 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/getutcfullyear/index.html @@ -0,0 +1,118 @@ +--- +title: Date.prototype.getUTCFullYear() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/getUTCFullYear +translation_of: Web/JavaScript/Reference/Global_Objects/Date/getUTCFullYear +--- +
{{JSRef("Global_Objects", "Date")}}
+ +

Resum

+ +

El mètode getUTCFullYear() retorna l'any de la data especificada, segons el temps universal.

+ +

Sintaxi

+ +
dateObj.getUTCFullYear()
+ +

Paràmetres

+ +

Cap.

+ +

Retorn

+ +

El valor retornat per getUTCFullYear() és un nombre absolut que compleix amb any-2000, per exemple, 1995.

+ +

Exemples

+ +

Exemple: Utilitzar getUTCFullYear()

+ +

L'exemple següent assigna el valor de 4 dígits de l'any actual a la variable any.

+ +
var avui = new Date();
+var any = avui.getUTCFullYear();
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a 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')}} 
+ +

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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/getutchours/index.html b/files/ca/web/javascript/reference/global_objects/date/getutchours/index.html new file mode 100644 index 0000000000..f575df92a1 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/getutchours/index.html @@ -0,0 +1,118 @@ +--- +title: Date.prototype.getUTCHours() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/getUTCHours +translation_of: Web/JavaScript/Reference/Global_Objects/Date/getUTCHours +--- +
{{JSRef("Global_Objects", "Date")}}
+ +

Resum

+ +

El mètode getUTCHours() retorna les hores especificades a la data, d'acord l'hora universal.

+ +

Sintaxi

+ +
dateObj.getUTCHours()
+ +

Paràmetres

+ +

Cap.

+ +

Retorn

+ +

El valor retornat per getUTCHours() és un nombre sencer entre 0 i 23.

+ +

Exemples

+ +

Exemple: Utilitzar getUTCHours()

+ +

L'exemple següent assigna la part de les hores de la data actual a la variable hora.

+ +
var avui = new Date();
+var hora = avui.getUTCHours();
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a JavaScript 1.3.
{{SpecName('ES5.1', '#sec-15.9.5.19', 'Date.prototype.getUTCHours')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.getutchours', 'Date.prototype.getUTCHours')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/getutcmilliseconds/index.html b/files/ca/web/javascript/reference/global_objects/date/getutcmilliseconds/index.html new file mode 100644 index 0000000000..d09ac5bded --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/getutcmilliseconds/index.html @@ -0,0 +1,116 @@ +--- +title: Date.prototype.getUTCMilliseconds() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/getUTCMilliseconds +translation_of: Web/JavaScript/Reference/Global_Objects/Date/getUTCMilliseconds +--- +
{{JSRef}}
+ +

El mètode getUTCMilliseconds() retorna els milisegons de la data especificada, d'acord al temps universal.

+ +

Sintaxi

+ +
objecteData.getUTCMilliseconds()
+ +

Paràmetres

+ +

Cap.

+ +

Valor retornat

+ +

El valor retorna per getUTCMilliseconds() és un nombre sencer entre 0 i 999.

+ +

Exemples

+ +

Utilitzar getUTCMilliseconds()

+ +

L'exemple següent assigna la porció de milisegons del temps actual a la variable milisegons.

+ +
var avui = new Date();
+var milisegons = avui.getUTCMilliseconds();
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.3.
{{SpecName('ES5.1', '#sec-15.9.5.25', 'Date.prototype.getUTCMilliseconds')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.getutcmilliseconds', 'Date.prototype.getUTCMilliseconds')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/getutcminutes/index.html b/files/ca/web/javascript/reference/global_objects/date/getutcminutes/index.html new file mode 100644 index 0000000000..e18a13c52f --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/getutcminutes/index.html @@ -0,0 +1,116 @@ +--- +title: Date.prototype.getUTCMinutes() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/getUTCMinutes +translation_of: Web/JavaScript/Reference/Global_Objects/Date/getUTCMinutes +--- +
{{JSRef}}
+ +

El mètode getUTCMinutes() retorna els minuts de la data especificada en temps universal.

+ +

Sintaxi

+ +
objecteData.getUTCMinutes()
+ +

Paràmetres

+ +

Cap.

+ +

Valor a retornar

+ +

El valor retornat per getUTCMinutes() és un nombre sencer entre 0 i 59.

+ +

Exemples

+ +

Utilitzar getUTCMinutes()

+ +

L'exemple següent assigna la part de minuts del temps actual a la variable minuts.

+ +
var avui = new Date();
+var minuts = avui.getUTCMinutes();
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.3.
{{SpecName('ES5.1', '#sec-15.9.5.21', 'Date.prototype.getUTCMinutes')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.getutcminutes', 'Date.prototype.getUTCMinutes')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/getutcmonth/index.html b/files/ca/web/javascript/reference/global_objects/date/getutcmonth/index.html new file mode 100644 index 0000000000..48ba78349b --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/getutcmonth/index.html @@ -0,0 +1,116 @@ +--- +title: Date.prototype.getUTCMonth() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/getUTCMonth +translation_of: Web/JavaScript/Reference/Global_Objects/Date/getUTCMonth +--- +
{{JSRef}}
+ +

El mètode getUTCMonth() retorna el mes de la data especificada d'acord al temps universal, com a valor basat en zero (on zero indica el primer mes de l'any.

+ +

Sintaxi

+ +
objecteData.getUTCMonth()
+ +

Paràmetres

+ +

Cap.

+ +

Valor retornat

+ +

El valor retornat per getUTCMonth() és un nombre sencer entre 0 i 11 corresponent al mes. 0 per al gener, 1 per al febrer, 2 per al març, etcètera.

+ +

Exemples

+ +

Utilitzar getUTCMonth()

+ +

L'exemple següent assigna la part de la data actual corresponent al mes a la variable mes.

+ +
var avui = new Date();
+var mes = mes.getUTCMonth();
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.3.
{{SpecName('ES5.1', '#sec-15.9.5.13', 'Date.prototype.getUTCMonth')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.getutcmonth', 'Date.prototype.getUTCMonth')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/getutcseconds/index.html b/files/ca/web/javascript/reference/global_objects/date/getutcseconds/index.html new file mode 100644 index 0000000000..1f69ca8199 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/getutcseconds/index.html @@ -0,0 +1,118 @@ +--- +title: Date.prototype.getUTCSeconds() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/getUTCSeconds +translation_of: Web/JavaScript/Reference/Global_Objects/Date/getUTCSeconds +--- +
{{JSRef("Global_Objects", "Date")}}
+ +

Resum

+ +

El mètode getUTCSeconds() retorna els segons a la data especificada, segons l'hora universal.

+ +

Sintaxi

+ +
dateObj.getUTCSeconds()
+ +

Paràmetres

+ +

Cap.

+ +

Retorna

+ +

El valor retornat per getUTCSeconds() és un nombre sencer entre 0 i 59.

+ +

Exemples

+ +

Exemple: Utilitzar getUTCSeconds()

+ +

L'exemple següent assigna la porció de segons del temps actual a la variable segons.

+ +
var avui = new Date();
+var segons = avui.getUTCSeconds();
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a JavaScript 1.3.
{{SpecName('ES5.1', '#sec-15.9.5.23', 'Date.prototype.getUTCSeconds')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.getutcseconds', 'Date.prototype.getUTCSeconds')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/getyear/index.html b/files/ca/web/javascript/reference/global_objects/date/getyear/index.html new file mode 100644 index 0000000000..8724b2e03b --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/getyear/index.html @@ -0,0 +1,162 @@ +--- +title: Date.prototype.getYear() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/getYear +translation_of: Web/JavaScript/Reference/Global_Objects/Date/getYear +--- +
{{JSRef("Global_Objects", "Date")}} {{deprecated_header}}
+ +

Resum

+ +

El mètode getYear() retorna l'any de la data especificada segons l'hora local. Com que getYear() no retorna anys sencers ("el problema de l'any 2000"), no s'utilitza més i s'ha substituït pel mètode {{jsxref("Date.prototype.getFullYear", "getFullYear()")}}.

+ +

Sintaxi

+ +
dateObj.getYear()
+ +

Paràmetres

+ +

Cap.

+ +

Retorna

+ +

El mètode getYear() retorna l'any menys el valor 1900; és a dir:

+ + + +

Per a tenir en compte anys abans o deprés del 2000 es recomana utilitzar {{jsxref("Date.prototype.getFullYear", "getFullYear()")}} en comptes de getYear() ja que retorna l'any sencer.

+ +

Compatibilitat amb versions anteriors

+ +

Comportament en JavaScript 1.2 i anteriors

+ +

El mètode getYear() retorna o bé un any amb dos dígits o bé un any amb 4 dígits:

+ + + +

Exemples

+ +

Exemple: Anys entre1900 i 1999

+ +

La segona sentència assigna el valor 95 a la variable any.

+ +
var nadal = new Date('December 25, 1995 23:15:00');
+var any = nadal.getYear(); // retorna 95
+
+ +

Exemple: Anys majors que 1999

+ +

La segona sentència assigna el valor 100 a la variable any.

+ +
var nadal = new Date('December 25, 2000 23:15:00');
+var any = Xmas.getYear(); // retorna 100
+
+ +

Exemple: Anys menors que 1900

+ +

La segona sentència assigna el valor -100 a la variable any.

+ +
var nadal = new Date('December 25, 1800 23:15:00');
+var any = nadal.getYear(); // retorna -100
+
+ +

Exemple: Assignar i obtenir un any entre1900 i 1999

+ +

La segona sentència assigna el valor 95 a la variable any, que representa l'any 1995.

+ +
var nadal.setYear(95);
+var any = nadal.getYear(); // retorna 95
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a JavaScript 1.3.
{{SpecName('ES5.1', '#sec-B.2.4', 'Date.prototype.getYear')}}{{Spec2('ES5.1')}}Definit a l'annex de compatibilitat (amb caràcter informatiu).
{{SpecName('ES6', '#sec-date.prototype.getyear', 'Date.prototype.getYear')}}{{Spec2('ES6')}}Definit a l'annex de característiques adicionals per a navegadors web (amb caràcter normatiu).
+ +

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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/index.html b/files/ca/web/javascript/reference/global_objects/date/index.html new file mode 100644 index 0000000000..3fb5a9368d --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/index.html @@ -0,0 +1,250 @@ +--- +title: Date +slug: Web/JavaScript/Referencia/Objectes_globals/Date +translation_of: Web/JavaScript/Reference/Global_Objects/Date +--- +
{{JSRef("Global_Objects", "Date")}}
+ +

Resum

+ +

Crea una instància de tipus Date de JavaScript, que representa un únic moment en el temps. Els objectes de tipus Date es basen en un valor de temps que mesura el nombre de milisegons que han passat des de l'u de gener de 1970 UTC.

+ +

Constructor

+ +
new Date();
+new Date(valor);
+new Date(dataString);
+new Date(any, mes[, dia[, hora[, minuts[, segons[, milisegons]]]]]);
+
+ +
+

Nota: Els objectes Date de JavaScript només poden ser instanciats cridant Date com a constructor: Si es crida la funció com una funció normal (és a dir, sense l'operador {{jsxref("Operators/new", "new")}}), aquesta retornarà una string en comptes d'un objecte de tipus Date; al contrari que altres tipus d'objectes JavaScript, els objectes de JavaScript de tipus Date no poden ser representats com a literals.

+
+ +

Paràmetres

+ +
+

Nota: Quan es crida Date com a constructor amb més d'un argument, si els valors són més grans que el seu rang lògic (per exemple, si es passa 13 com a valor pel mes o 70 com a valor de minuts), Date ajusta el valor adjacent. Per exemple, new Date(2013, 13, 1) és equivalent a new Date(2014, 1, 1), ambdós creen un objecte de tipus Date que representa 2014-02-01 (cal destacar que els mesos es comencen a contar des de zero). El mateix s'aplica per a altres valors: new Date(2013, 2, 1, 0, 70) és equivalent a new Date(2013, 2, 1, 1, 10) i ambdós representen 2013-03-01T01:10:00.

+
+ +
+

Nota: Quan es crida Date com a constructor amb més d'un argument, els arguments especificats representen l'hora local. Si es pretèn passar valors UTC, utilitzeu new Date({{jsxref("Date.UTC()", "Date.UTC(...)")}}) amb aquests arguments.

+
+ +
+
valor
+
Nombre sencer que representa el nombre de milisegons des de l'1 de gener de 1970 00:00:00 UTC (Època UNIX).
+
dataString
+
Valor String que representa una data. La String ha d'estar en un format reconegut pel mètode {{jsxref("Date.parse()")}} (Marques de temps RFC 2822 compatibles amb el IETF o bé una versió de la ISO8601).
+
any
+
Valor sencer que representa un any. Els valors des de 0 a 99 representen els anys des de 1900 a 1999. Vegeu l'{{anch("Example:_Two_digit_years_map_to_1900_-_1999", "exemple a continuació")}}.
+
mes
+
Valor sencer que representa un mes, començant per zero com a gener i acabant amb 11 com a desembre.
+
dia
+
Opcional. Valor sencer que representa el dia del mes.
+
hora
+
Opcional. Valor sencer que representa l'hora del dia.
+
minut
+
Opcional. Valor sencer que representa els minuts d'un segment de temps.
+
segon
+
Opcional. Valor sencer que representa els segons d'un segment de temps.
+
milisegons
+
Opcional. Valor sencer que representa els milisegons d'un segment de temps.
+
+ +

Descripció

+ + + +

Propietats

+ +
+
{{jsxref("Date.prototype")}}
+
Permet afegir propietats a l'objecte de JavaScript Date.
+
Date.length
+
El valor de Date.length és 7. Aquest és el nombre de arguments que el constructor accepta.
+
+ +
{{jsOverrides("Function", "properties", "prototype")}}
+ +

Mètodes

+ +
+
{{jsxref("Date.now()")}}
+
Retorna el valor numèric corresponent al temps actual - el nombre de milisegons que han passat des de l'1 de gener de 1970 00:00:00 UTC.
+
{{jsxref("Date.parse()")}}
+
Interpreta un string que representa una data i retorna el nombre de milisegons des de l'1 de gener de 1970 00:00:00 UTC.
+
{{jsxref("Date.UTC()")}}
+
Accepta els mateixos paràmetres que el constructor (és a dir, de 2 a 7) i retorna le nombre de milisegons des de l'1 de gener de 1970 00:00:00 UTC.
+
+ +
{{jsOverrides("Function", "Methods", "now", "parse", "UTC")}}
+ +

Instàncies de JavaScript Date

+ +

Totes les instàncies de Date hereten de {{jsxref("Date.prototype")}}. L'objecte prototipus del constructor Date pot ser modificat per a afectar a totes les instàncies de Date.

+ +

Mètodes de Date.prototype

+ +
{{page('/ca/docs/Web/JavaScript/Reference/Global_Objects/Date/prototype', 'Methods')}}
+ +

Exemples

+ +

Exemple: Vàries formes de crear un objecte de tipus Date

+ +

Els següents exemples mostren diverses maneres de crear dates a JavaScript:

+ +
var today = new Date();
+var birthday = new Date('December 17, 1995 03:24:00');
+var birthday = new Date('1995-12-17T03:24:00');
+var birthday = new Date(1995, 11, 17);
+var birthday = new Date(1995, 11, 17, 3, 24, 0);
+
+ +

Exemple: Dos dígits per representar els anys 1900 a 1999

+ +

Per a crear i obtindre dates entre els anys 0 i 99 es recomana emprar els mètodes {{jsxref("Date.prototype.setFullYear()")}} i {{jsxref("Date.prototype.getFullYear()")}}.

+ +
var date = new Date(98, 1); // Sun Feb 01 1998 00:00:00 GMT+0000 (GMT)
+
+// Deprecated method, 98 maps to 1998 here as well
+date.setYear(98);           // Sun Feb 01 1998 00:00:00 GMT+0000 (GMT)
+
+date.setFullYear(98);       // Sat Feb 01 0098 00:00:00 GMT+0000 (BST)
+
+ +

Exemple: Calcular el temps passat

+ +

Els exemples següents mostren com determinar el temps passat entre dues dates a JavaScript:

+ +
// utilitzant objectes Date
+var start = Date.now();
+
+// L'event a cronometra va aquí:
+doSomethingForALongTime();
+var end = Date.now();
+var elapsed = end - start; // temps transcorregut en milisegons
+
+ +
// utilitzant mètodes que formen part del sistema
+var start = new Date();
+
+// the event to time goes here:
+doSomethingForALongTime();
+var end = new Date();
+var elapsed = end.getTime() - start.getTime(); // temps transcorregut en milisegons
+
+ +
// cronometra una funció i retorna el que retorni
+function printElapsedTime(fTest) {
+  var nStartTime = Date.now(),
+      vReturn = fTest(),
+      nEndTime = Date.now();
+
+  console.log('Temps transcorregut: ' + String(nEndTime - nStartTime) + ' miliseconds');
+  return vReturn;
+}
+
+yourFunctionReturn = printElapsedTime(yourFunction);
+
+ +
+

Nota: En navegadors que suporten la característica de temps en alta resolució de la {{domxref("window.performance", "API d'Alt Rendiment Web", "", 1)}}, {{domxref("Performance.now()")}} pot proporcionar mesures de temps més concises i fiables pel temps transcorregut que {{jsxref("Date.now()")}}.

+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a JavaScript 1.1.
{{SpecName('ES5.1', '#sec-15.9', 'Date')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date-objects', 'Date')}}{{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}}
+
+ +

Informes de compatiblitat amb navegadors

+ + + +

Notes específiques de Internet Explorer

+ +

Internet Explorer 8 no suporta el format de dates ISO8601.

diff --git a/files/ca/web/javascript/reference/global_objects/date/now/index.html b/files/ca/web/javascript/reference/global_objects/date/now/index.html new file mode 100644 index 0000000000..c3ef05fa86 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/now/index.html @@ -0,0 +1,126 @@ +--- +title: Date.now() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/now +translation_of: Web/JavaScript/Reference/Global_Objects/Date/now +--- +
{{JSRef("Global_Objects", "Date")}}
+ +

Resum

+ +

El mètode Date.now() retorna el nombre de milisegons que han passat des de l'1 de gener de 1970 00:00:00 UTC.

+ +

Sintaxi

+ +
var timeInMs = Date.now();
+ +

Paràmetres

+ +

Cap.

+ +

Descripció

+ +

El mètode now() retorna el nombre de method returns el nombre de milisegons que han passat des de l'1 de gener de 1970 00:00:00 UTC fins al moment actual representat en un  {{jsxref("Global_Objects/Number", "Nombre")}}.

+ +

Com que now() és un mètode estàtic de {{jsxref("Global_Objects/Date", "Date")}}, sempre es crida com a Date.now().

+ +

Polyfill

+ +

Aquest mètode va ser estandaritzat a la cinquena edició de l'ECMA-262. Els motors que encara no hagin sigut actualitzats per a suportar aquest mètode poden utilitzar el bocí de codi següent per a paliar l'absència d'aquest mètode:

+ +
if (!Date.now) {
+  Date.now = function now() {
+    return new Date().getTime();
+  };
+}
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES5.1', '#sec-15.9.4.4', 'Date.now')}}{{Spec2('ES5.1')}}Definició inicial. Implementat a JavaScript 1.5.
{{SpecName('ES6', '#sec-date.now', 'Date.now')}}{{Spec2('ES6')}} 
+ +

Compatibilitat amb navegadors

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
CaracterístiquesChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatChrome("5")}}{{CompatGeckoDesktop("1.9")}}{{CompatIE("9")}}{{CompatOpera("10.50")}}{{CompatSafari("4")}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
CaracterístiquesAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
+ + + + + + +
Suport bàsic
+
{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +

Basat en la  taula de compatibilitat de Kangax.

+ +

Vegeu també

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/setdate/index.html b/files/ca/web/javascript/reference/global_objects/date/setdate/index.html new file mode 100644 index 0000000000..746de134fe --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/setdate/index.html @@ -0,0 +1,122 @@ +--- +title: Date.prototype.setDate() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/setDate +translation_of: Web/JavaScript/Reference/Global_Objects/Date/setDate +--- +
{{JSRef}}
+ +

El mètode setDate() assigna el dia de l'objecte {{jsxref("Date")}} relatiu al principi del mes assignat en aquell moment.

+ +

Sintaxi

+ +
objecteData.setDate(dia)
+ +

Paràmetres

+ +
+
dia
+
Un nombre sencer que representa el dia del mes.
+
+ +

Valor retornat

+ +

El valor retornat per setDate() és el nombre de milisegons que han passat des de l'ú de gener de 1970 00:00:00 UTC de la data resultant (l'objecte {{jsxref("Date")}} també canvia).

+ +

Descripció

+ +

Si es passa un paràmetre que està fora del rang esperat, el mètode setDate() actualitza els altres paràmetres per a acceptar el nombre. Per exemple, si es passa 0 com a dia, la data representarà l'últim dia del mes anterior.

+ +

Exemples

+ +

Utilitzar setDate()

+ +
var elGranDia = new Date(1962, 6, 7); // 1962-07-07
+elGranDia.setDate(24);  // 1962-07-24
+elGranDia.setDate(32);  // 1962-08-01
+elGranDia.setDate(22);  // 1962-08-22
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.9.5.36', 'Date.prototype.setDate')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.setdate', 'Date.prototype.setDate')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/setfullyear/index.html b/files/ca/web/javascript/reference/global_objects/date/setfullyear/index.html new file mode 100644 index 0000000000..c29d56ca4e --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/sethours/index.html b/files/ca/web/javascript/reference/global_objects/date/sethours/index.html new file mode 100644 index 0000000000..7f660ba344 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/sethours/index.html @@ -0,0 +1,129 @@ +--- +title: Date.prototype.setHours() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/setHours +translation_of: Web/JavaScript/Reference/Global_Objects/Date/setHours +--- +
{{JSRef}}
+ +

El mètode setHours() assigna l'hora per a una data especificada d'acord a l'hora local, i retorna el nombre de milisegons que han passat des de l'u de gener de 1970 00:00:00 UTC fins al temps representat per la instància de {{jsxref("Date")}} actualitzada.

+ +

Sintaxi

+ +
objecteData.setHours(hores[, minuts[, segons[, milisegons]]])
+ +

Versions anteriors a JavaScript 1.3

+ +
objecteData.setHours(hores)
+ +

Paràmetres

+ +
+
hores
+
Un nombre sencer entre 0 i 23, que representa l'hora.
+
minuts
+
Opcional. Un nombre sencer entre 0 i 59 que representa els minuts.
+
segons
+
Opcional. Un nombre sencer entre 0 i 59 que representa els segons.
+
milisegons
+
Opcional. Un nombre sencer entre 0 i 999 que representa els milisegons.
+
+ +

Descripció

+ +

Si no s'especifiquen els paràmetres minuts, segons i milisegons s'utilitzen els valors retornats per {{jsxref("Date.prototype.getMinutes()", "getMinutes()")}}, {{jsxref("Date.prototype.getSeconds()", "getSeconds()")}} i {{jsxref("Date.prototype.getMilliseconds()", "getMilliseconds()")}}.

+ +

Si es passa un paràmetre que està fora del rang esperat, el mètode setHours() actualitza els altres paràmetres per a acceptar el nombre. Per exemple, si es passa 100 com a segons, els minuts seran incrementats en 1 (minuts + 1), i s'emprarà 40 com a segons.

+ +

Exemples

+ +

Utilitzar setHours()

+ +
var elGranDia = new Date();
+elGranDia.setHours(7);
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.9.5.34', 'Date.prototype.setHours')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.sethours', 'Date.prototype.setHours')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/setmilliseconds/index.html b/files/ca/web/javascript/reference/global_objects/date/setmilliseconds/index.html new file mode 100644 index 0000000000..53dc451ad4 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/setmilliseconds/index.html @@ -0,0 +1,117 @@ +--- +title: Date.prototype.setMilliseconds() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/setMilliseconds +translation_of: Web/JavaScript/Reference/Global_Objects/Date/setMilliseconds +--- +
{{JSRef}}
+ +

El mètode setMilliseconds() assigna els milisegons per a una data especificada d'acord a l'hora local.

+ +

Sintaxi

+ +
objecteData.setMilliseconds(milisegons)
+ +

Paràmetres

+ +
+
milisegons
+
Un nombre sencer entre 0 i 999 que representa els milisegons.
+
+ +

Descripció

+ +

Si es passa un paràmetre que està fora del rang esperat, el mètode setMilliseconds() actualitza els altres paràmetres per a acceptar el nombre. Per exemple, si es passa 1005 com a milisegons, els segonsseran incrementats en 1 (segons + 1), i s'emprarà 5 com a milisegons.

+ +

Exemples

+ +

Utilitzar setMilliseconds()

+ +
var elGranDia= new Date();
+elGranDia.setMilliseconds(100);
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComenataris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.3.
{{SpecName('ES5.1', '#sec-15.9.5.28', 'Date.prototype.setMilliseconds')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.setmilliseconds', 'Date.prototype.setMilliseconds')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/setminutes/index.html b/files/ca/web/javascript/reference/global_objects/date/setminutes/index.html new file mode 100644 index 0000000000..7dba61cade --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/setminutes/index.html @@ -0,0 +1,127 @@ +--- +title: Date.prototype.setMinutes() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/setMinutes +translation_of: Web/JavaScript/Reference/Global_Objects/Date/setMinutes +--- +
{{JSRef}}
+ +

El mètode setMinutes() assigna els minuts a una data especificada, d'acord a l'hora local.

+ +

Sintaxi

+ +
objecteData.setMinutes(minuts[, segons[, milisegons]])
+ +

Versions anteriors a JavaScript 1.3

+ +
objecteData.setMinutes(minuts)
+ +

Paràmetres

+ +
+
minuts
+
Un nombre sencer entre 0 i 59 que representa els minuts.
+
segons
+
Opcional. Un nombre sencer entre 0 i 59 que representa els segons.
+
milisegons
+
Opcional. Un nombre sencer entre 0 i 999 que representa els milisegons.
+
+ +

Descripció

+ +

Si no s'especifiquen els paràmetres minuts, segons i milisegons s'utilitzen els valors retornats per {{jsxref("Date.prototype.getSeconds()", "getSeconds()")}} i {{jsxref("Date.prototype.getMilliseconds()", "getMilliseconds()")}}.

+ +

Si es passa un paràmetre que està fora del rang esperat, el mètode setMinutes() actualitza els altres paràmetres per a acceptar el nombre. Per exemple, si es passa 100 com a segons, els minuts seran incrementats en 1 (minuts + 1), i s'emprarà 40 com a segons.

+ +

Exemples

+ +

Utilitzar setMinutes()

+ +
var elGranDia = new Date();
+elGranDia.setMinutes(45);
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.9.5.32', 'Date.prototype.setMinutes')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.setminutes', 'Date.prototype.setMinutes')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/setmonth/index.html b/files/ca/web/javascript/reference/global_objects/date/setmonth/index.html new file mode 100644 index 0000000000..a84f51df7c --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/setmonth/index.html @@ -0,0 +1,126 @@ +--- +title: Date.prototype.setMonth() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/setMonth +translation_of: Web/JavaScript/Reference/Global_Objects/Date/setMonth +--- +
{{JSRef}}
+ +

El mètode setMonth() assigna el mes per a una data especificada d'acord a l'any assignat previament.

+ +

Sintaxi

+ +
objecteData.setMonth(mes[, dia])
+ +

Versions anteriors a JavaScript 1.3

+ +
objecteData.setMonth(mes)
+ +

Paràmetres

+ +
+
mes
+
Un nombre sencer entre 0 i 11 que representa els mesos des de gener fins a desembre
+
dia
+
Opcional. Un nombre sencer entre 1 i 31 que representa el dia del mes.
+
 
+
+ +

Descripció

+ +

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

+ +

Si es passa un paràmetre que està fora del rang esperat, el mètode setMonth() 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 setMonth()

+ +
var elGranDia = new Date();
+elGranDia.setMonth(6);
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.9.5.38', 'Date.prototype.setMonth')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.setmonth', 'Date.prototype.setMonth')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/setseconds/index.html b/files/ca/web/javascript/reference/global_objects/date/setseconds/index.html new file mode 100644 index 0000000000..60ea2c0ae3 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/setseconds/index.html @@ -0,0 +1,125 @@ +--- +title: Date.prototype.setSeconds() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/setSeconds +translation_of: Web/JavaScript/Reference/Global_Objects/Date/setSeconds +--- +
{{JSRef}}
+ +

El mètode setSeconds() assigna els segons per a una data especificada, en temps local.

+ +

Sintaxi

+ +
objecteData.setSeconds(segons[, milisegons])
+ +

Versions anteriors a JavaScript 1.3

+ +
objecteData.setSeconds(segons)
+ +

Paràmetres

+ +
+
segons
+
Un nombre sencer entre 0 i 59 que representa els segons.
+
milisegons
+
Opcional. Un nombre sencer entre 0 i 999 que representa els milisegons.
+
+ +

Descripció

+ +

Si no s'especifica el paràmetre milisegons s'utilitza el valor retornat pel mètode {{jsxref("Date.prototype.getMilliseconds()", "getMilliseconds()")}}.

+ +

Si es passa un paràmetre que està fora del rang esperat, el mètode setSeconds() actualitza els altres paràmetres per a acceptar el nombre. Per exemple, si es passa 100 com a segons, els minuts seran incrementats en 1 (minuts + 1), i s'emprarà 40 com a segons.

+ +

Exemples

+ +

Utilitzar setSeconds()

+ +
var elGranDia = new Date();
+elGranDia.setSeconds(30);
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacionsEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.9.5.30', 'Date.prototype.setSeconds')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.setseconds', 'Date.prototype.setSeconds')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/settime/index.html b/files/ca/web/javascript/reference/global_objects/date/settime/index.html new file mode 100644 index 0000000000..9774f3ee4c --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/settime/index.html @@ -0,0 +1,118 @@ +--- +title: Date.prototype.setTime() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/setTime +translation_of: Web/JavaScript/Reference/Global_Objects/Date/setTime +--- +
{{JSRef}}
+ +

El mètode setTime() configura l'objecte {{jsxref("Date")}} amb un nombre que representa un temps en milisegons que han passat des de la mitjanit de l'ú de gener de 1970, en temps universal.

+ +

Sintaxi

+ +
objecteData.setTime(temps)
+ +

Paràmetres

+ +
+
temps
+
Un nombre sencer que representa el nombre de milisegons que han passat des de l'1 de gener de 1970 00:00:00 UTC.
+
+ +

Descripció

+ +

Utilitzeu el mètode setTime() per a assignar una data i hora a un objecte de tipus {{jsxref("Date")}}.

+ +

Exemples

+ +

Utilitzar setTime()

+ +
var elGranDia = new Date('July 1, 1999');
+var elMateixGranDia = new Date();
+elMateixGranDia.setTime(elGranDia.getTime());
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.9.5.27', 'Date.prototype.setTime')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.settime', 'Date.prototype.setTime')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/setutcdate/index.html b/files/ca/web/javascript/reference/global_objects/date/setutcdate/index.html new file mode 100644 index 0000000000..109178f66a --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/setutcdate/index.html @@ -0,0 +1,119 @@ +--- +title: Date.prototype.setUTCDate() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/setUTCDate +translation_of: Web/JavaScript/Reference/Global_Objects/Date/setUTCDate +--- +
{{JSRef}}
+ +

El mètode setUTCDate() assigna el dia del mes per a una data especificada, en temps universal.

+ +

Sintaxi

+ +
objecteData.setUTCDate(dia)
+ +

Paràmetres

+ +
+
dia
+
Un nombre sencer de 1 a 31, que representa el dia del mes.
+
+ +

Descripció

+ +

If a parameter you specify is outside of the expected range, setUTCDate() attempts to update the date information in the {{jsxref("Date")}} object accordingly. For example, if you use 40 for dayValue, and the month stored in the {{jsxref("Date")}} object is June, the day will be changed to 10 and the month will be incremented to July.

+ +

Si es passa un paràmetre que està fora del rang esperat, el mètode setUTCDate() actualitza els altres paràmetres per a acceptar el nombre. Per exemple, si es passa 40 com a dia, i el mes especificat a l'objecte {{jsxref("Date")}} és juny, el dia es canviarà a 10 i el mes serà incrementat a juliol.

+ +

Exemples

+ +

Utilitzar setUTCDate()

+ +
var elGranDia = new Date();
+elGranDia.setUTCDate(20);
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.3.
{{SpecName('ES5.1', '#sec-15.9.5.37', 'Date.prototype.setUTCDate')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.setutcdate', 'Date.prototype.setUTCDate')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/setutcfullyear/index.html b/files/ca/web/javascript/reference/global_objects/date/setutcfullyear/index.html new file mode 100644 index 0000000000..55185a431b --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/setutcfullyear/index.html @@ -0,0 +1,123 @@ +--- +title: Date.prototype.setUTCFullYear() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/setUTCFullYear +translation_of: Web/JavaScript/Reference/Global_Objects/Date/setUTCFullYear +--- +
{{JSRef}}
+ +

El mètode setUTCFullYear() assigna l'any sencer a la data especificada d'acord amb el temps universal.

+ +

Sintaxi

+ +
objecteData.setUTCFullYear(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. Si s'especifica el paràmetre dia, també s'ha d'especificar el paràmetre mes.
+
+ +

Descripció

+ +

Si no s'especifica els paràmetres mes o dia s'utilitza el valor retornat pels mètodes getMonth() i getDate().

+ +

Si es passa un paràmetre que està fora del rang esperat, el mètode setUTCFullYear() 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 setUTCFullYear()

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

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.3.
{{SpecName('ES5.1', '#sec-15.9.5.41', 'Date.prototype.setUTCFullYear')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.setutcfullyear', 'Date.prototype.setUTCFullYear')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/setutchours/index.html b/files/ca/web/javascript/reference/global_objects/date/setutchours/index.html new file mode 100644 index 0000000000..3c75ea903c --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/setutchours/index.html @@ -0,0 +1,125 @@ +--- +title: Date.prototype.setUTCHours() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/setUTCHours +translation_of: Web/JavaScript/Reference/Global_Objects/Date/setUTCHours +--- +
{{JSRef}}
+ +

El mètode setUTCHours() assigna l'hora per a una data especificada d'acord al temps universal, i retorna el nombre de milisegons que han passat des de l'ú de gener de 1970 00:00:00 UTC fins al temps representat per l'instància {{jsxref("Date")}} actualitzada.

+ +

Sintaxi

+ +
objecteData.setUTCHours(hores[, minuts[, segons[, milisegons]]])
+ +

Paràmetres

+ +
+
hores
+
Un nombre sencer entre 0 i 23, que representa l'hora.
+
minuts
+
Opcional. Un nombre sencer entre 0 i 59 que representa els minuts.
+
segons
+
Oppcional. Un nombre sencer entre 0 i 59 que representa els segons. Si s'especifica segons també s'ha d'expecificar minuts.
+
milisegons
+
Opcional. Un nombre sencer entre 0 i 999 que representa els milisegons. Si s'especifica milisegons també s'han d'especificar minuts i segons.
+
+ +

Descripció

+ +

Si no s'especifica els paràmetres minuts, segons o milisegons s'utilitza el valor retornat pels mètodes {{jsxref("Date.prototype.getUTCMinutes()", "getUTCMinutes()")}}, {{jsxref("Date.prototype.getUTCSeconds()", "getUTCSeconds()")}}, i {{jsxref("Date.prototype.getUTCMilliseconds()", "getUTCMilliseconds()")}}.

+ +

Si es passa un paràmetre que està fora del rang esperat, el mètode setUTCHours() actualitza els altres paràmetres per a acceptar el nombre. Per exemple, si es passa 100 com a segons, els minuts seran incrementats en 1 (minuts + 1), i s'emprarà 40 com a segons.

+ +

Exemples

+ +

Utilitzar setUTCHours()

+ +
var elGranDia = new Date();
+elGranDia.setUTCHours(8);
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.3.
{{SpecName('ES5.1', '#sec-15.9.5.35', 'Date.prototype.setUTCHours')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.setutchours', 'Date.prototype.setUTCHours')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/setutcmilliseconds/index.html b/files/ca/web/javascript/reference/global_objects/date/setutcmilliseconds/index.html new file mode 100644 index 0000000000..e3265e247f --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/setutcmilliseconds/index.html @@ -0,0 +1,117 @@ +--- +title: Date.prototype.setUTCMilliseconds() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/setUTCMilliseconds +translation_of: Web/JavaScript/Reference/Global_Objects/Date/setUTCMilliseconds +--- +
{{JSRef}}
+ +

El mètode setUTCMilliseconds() assigna els milisegons a la data sepecificada d'acord l'hora local.

+ +

Sintaxi

+ +
objecteData.setUTCMilliseconds(milisegons)
+ +

Paràmetres

+ +
+
milisegons
+
Un nombre sencer entre 0 i 999 que representa els milisegons.
+
+ +

Descripció

+ +

Si es passa un paràmetre que està fora del rang esperat, el mètode setUTCMilliseconds() actualitza els altres paràmetres per a acceptar el nombre. Per exemple, si es passa 1100 com a milisegons, els segons seran incrementats en 1 (segons + 1), i s'emprarà 100 com a milisegons.

+ +

Exemples

+ +

Utilitzar setUTCMilliseconds()

+ +
var elGranDia = new Date();
+elGranDia.setUTCMilliseconds(500);
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.3.
{{SpecName('ES5.1', '#sec-15.9.5.29', 'Date.prototype.setUTCMilliseconds')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.setutcmilliseconds', 'Date.prototype.setUTCMilliseconds')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/setutcminutes/index.html b/files/ca/web/javascript/reference/global_objects/date/setutcminutes/index.html new file mode 100644 index 0000000000..5551364e52 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/setutcminutes/index.html @@ -0,0 +1,123 @@ +--- +title: Date.prototype.setUTCMinutes() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/setUTCMinutes +translation_of: Web/JavaScript/Reference/Global_Objects/Date/setUTCMinutes +--- +
{{JSRef}}
+ +

El mètode setUTCMinutes() assigna els minuts per a la data especificada, segons l'hora local.

+ +

Sintaxi

+ +
objecteData.setUTCMinutes(minuts[, segons[, milisegons]])
+ +

Paràmetres

+ +
+
minuts
+
Un nombre sencer entre 0 i 59, que representa els minuts.
+
segons
+
Oppcional. Un nombre sencer entre 0 i 59 que representa els segons. Si s'especifica segons també s'ha d'expecificar minuts.
+
milisegons
+
Opcional. Un nombre sencer entre 0 i 999 que representa els milisegons. Si s'especifica milisegons també s'han d'especificar minuts i segons.
+
+ +

Descripció

+ +

Si no s'especifica els paràmetres segons o milisegons s'utilitza el valor retornat pels mètodes {{jsxref("Date.prototype.getUTCSeconds()", "getUTCSeconds()")}} i {{jsxref("Date.prototype.getUTCMilliseconds()", "getUTCMilliseconds()")}}.

+ +

Si es passa un paràmetre que està fora del rang esperat, el mètode setUTCMinutes() actualitza els altres paràmetres per a acceptar el nombre. Per exemple, si es passa 100 com a segons, els minuts seran incrementats en 1 (minuts + 1), i s'emprarà 40 com a segons.

+ +

Exemples

+ +

Utilitzar setUTCMinutes()

+ +
var elGranDia = new Date();
+elGranDia.setUTCMinutes(43);
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.3.
{{SpecName('ES5.1', '#sec-15.9.5.33', 'Date.prototype.setUTCMinutes')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.setutcminutes', 'Date.prototype.setUTCMinutes')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/setutcmonth/index.html b/files/ca/web/javascript/reference/global_objects/date/setutcmonth/index.html new file mode 100644 index 0000000000..e06f0fba64 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/setutcmonth/index.html @@ -0,0 +1,121 @@ +--- +title: Date.prototype.setUTCMonth() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/setUTCMonth +translation_of: Web/JavaScript/Reference/Global_Objects/Date/setUTCMonth +--- +
{{JSRef}}
+ +

El mètode setUTCMonth() assigna el mes per a la data especificada segons el temps universal.

+ +

Sintaxi

+ +
objecteData.setUTCMonth(mes[, dia])
+ +

Paràmetres

+ +
+
mes
+
Un nombre sencer entre 0 i 11 que representa els mesos des de gener fins a desembre
+
dia
+
Opcional. Un nombre sencer entre 1 i 31 que representa el dia del mes.
+
+ +

Descripció

+ +

Si no s'especifica el paràmetre dia s'utilitza el valor retornat pel mètode.{{jsxref("Date.prototype.getUTCDate()", "getUTCDate()")}}.

+ +

Si es passa un paràmetre que està fora del rang esperat, el mètode setUTCMonth() 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 setUTCMonth()

+ +
var elGranDia = new Date();
+elGranDia.setUTCMonth(11);
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.3.
{{SpecName('ES5.1', '#sec-15.9.5.39', 'Date.prototype.setUTCMonth')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.setutcmonth', 'Date.prototype.setUTCMonth')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/setutcseconds/index.html b/files/ca/web/javascript/reference/global_objects/date/setutcseconds/index.html new file mode 100644 index 0000000000..66f33a9e1b --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/setutcseconds/index.html @@ -0,0 +1,121 @@ +--- +title: Date.prototype.setUTCSeconds() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/setUTCSeconds +translation_of: Web/JavaScript/Reference/Global_Objects/Date/setUTCSeconds +--- +
{{JSRef}}
+ +

El mètode setUTCSeconds() assigna els segons a la data especificada, segons el temps universal.

+ +

Sintaxi

+ +
objecteData.setUTCSeconds(segons[, milisegons])
+ +

Paràmetres

+ +
+
segons
+
Un nombre sencer entre 0 i 59 que representa els segons.
+
milisegons
+
Opcional. Un nombre sencer entre 0 i 999 que representa els milisegons.
+
+ +

Descripció

+ +

Si no s'especifica el paràmetre milisegons s'utilitza el valor retornat pel mètode {{jsxref("Date.prototype.getUTCMilliseconds()", "getUTCMilliseconds()")}}.

+ +

Si es passa un paràmetre que està fora del rang esperat, el mètode setUTCSeconds() actualitza els altres paràmetres per a acceptar el nombre. Per exemple, si es passa 100 com a segons, els minuts seran incrementats en 1 (minuts + 1), i s'emprarà 40 com a segons.

+ +

Exemples

+ +

Utilitzar setUTCSeconds()

+ +
var elGranDia = new Date();
+elGranDia.setUTCSeconds(20);
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.3.
{{SpecName('ES5.1', '#sec-15.9.5.31', 'Date.prototype.setUTCSeconds')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.setutcseconds', 'Date.prototype.setUTCSeconds')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/setyear/index.html b/files/ca/web/javascript/reference/global_objects/date/setyear/index.html new file mode 100644 index 0000000000..ead16f2d21 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/setyear/index.html @@ -0,0 +1,124 @@ +--- +title: Date.prototype.setYear() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/setYear +translation_of: Web/JavaScript/Reference/Global_Objects/Date/setYear +--- +
{{JSRef}} {{deprecated_header}}
+ +

El mètode setYear() assigna l'any per a una data especificada, d'acord a l'hora local. Com que setYear() no utilitza anys complerts ("el problema de l'any 2000"), aquest mètode està en desús i s'ha reemplaçat pel mètode {{jsxref("Date.prototype.setFullYear()", "setFullYear()")}}.

+ +

Sintaxi

+ +
objecteData.setYear(any)
+ +

Paràmetres

+ +
+
any
+
Un nombre sencer.
+
+ +

Descripció

+ +

Si any és un nombre entre 0 i 99 (inclòs), llavors s'assigna 1900 + any a objecteData. En cas contrari, s'assigna any a objecteData.

+ +

Exemples

+ +

Utilitzar setYear()

+ +

Les dues primeres línies assignen el valor 1996 a l'any. La tercera línia assigna el valor 2000 a l'any.

+ +
var elGranDia = new Date();
+
+elGranDia.setYear(96);
+elGranDia.setYear(1996);
+elGranDia.setYear(2000);
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-B.2.5', 'Date.prototype.getYear')}}{{Spec2('ES5.1')}}Definit a l'annex de compatibilitat (informatiu).
{{SpecName('ES6', '#sec-date.prototype.setyear', 'Date.prototype.getYear')}}{{Spec2('ES6')}}Definit a l'annex de característiques adicionals per a navegadors web (normatiu).
+ +

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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/todatestring/index.html b/files/ca/web/javascript/reference/global_objects/date/todatestring/index.html new file mode 100644 index 0000000000..9548215179 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/todatestring/index.html @@ -0,0 +1,115 @@ +--- +title: Date.prototype.toDateString() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/toDateString +translation_of: Web/JavaScript/Reference/Global_Objects/Date/toDateString +--- +
{{JSRef}}
+ +

El mètode toDateString() retorna la part de la data d'un objecte {{jsxref("Date")}} en un format entenible per persones en anglés amerià.

+ +

Sintaxi

+ +
objecteData.toDateString()
+ +

Descripció

+ +

Les instàncies de Date representen un punt específic en el temps. Una crida al mètode toString() retornarà la dada en un format entenible per persones, en anglés americà. Al motor SpiderMonkey, aquest format consisteix en la part de la data (dia, mes i any) seguida de la part de l'hora (hores, minuts, segons i zona horària). De vegades és convenient obtenir un string només de la part de l'hora; aquesta és la raó de ser del mètode toDateString().

+ +

El mètode toDateString() resulta especialment útil perquè els motors que compleixen amb el standard ECMA-262 poden retornar resultats diferents al string obtingut mitjançant el mètode toString() en objectes Date, ja que el format depèn totalment de la implementació; això implica que partir el string per a obtenir només la part de temps pot no produïr un resultat consistent en tots els motors.

+ +

Exemples

+ +

Ús bàsic de toDateString()

+ +
var d = new Date(1993, 6, 28, 14, 39, 7);
+
+console.log(d.toString());     // imprimeix Wed Jul 28 1993 14:39:07 GMT-0600 (PDT)
+console.log(d.toDateString()); // imprimeix Wed Jul 28 1993
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES3')}}{{Spec2('ES3')}}Definició inicial.
{{SpecName('ES5.1', '#sec-15.9.5.3', 'Date.prototype.toDateString')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.todatestring', 'Date.prototype.toDateString')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/togmtstring/index.html b/files/ca/web/javascript/reference/global_objects/date/togmtstring/index.html new file mode 100644 index 0000000000..08e63be739 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/togmtstring/index.html @@ -0,0 +1,115 @@ +--- +title: Date.prototype.toGMTString() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/toGMTString +translation_of: Web/JavaScript/Reference/Global_Objects/Date/toGMTString +--- +
{{JSRef}} {{deprecated_header}}
+ +

El mètode toGMTString() converteix una data a un string, utilitzant les convencions del Greenwich Mean Time (GMT). El format exacte del valor retornat per toGMTString() és depenent de la plataforma i el navegador, per norma general hauria de representar la data en una forma entenible per persones.

+ +
+

Nota: toGMTString() està en desús i no es recomana fer-lo servir més. Es mantè només per a compatibilitat amb codi vell que l'utilitzi; en comptes d'aquest mètode utilitzeu {{jsxref("Date.prototype.toUTCString()", "toUTCString()")}}.

+
+ +

Sintaxi

+ +
objecteData.toGMTString()
+ +

Exemples

+ +

Exemple senzill

+ +

En aquest exemple el mètode toGMTString() converteix la data a GMT (UTC) utilitzant el desplaçament de zona horaria donat pel sistema operatiu i retorna un valor string que té aproximadament la forma que trobareu a continuació. El format exacte dependrà de la plataforma.

+ +
var avui = new Date();
+var str = avui.toGMTString();  // en desús! utilitzeu toUTCString()
+
+console.log(str);               // Mon, 18 Dec 1995 17:28:35 GMT
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial, però ja marcat com a en desús. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-B.2.6', 'Date.prototype.toGMTString')}}{{Spec2('ES5.1')}}Definit a l'annex de compatibilitat (informatiu).
{{SpecName('ES6', '#sec-date.prototype.togmtstring', 'Date.prototype.toGMTString')}}{{Spec2('ES6')}}Definit a l'annex per a característiques adicionals per a navegadors web (normatiu).
+ +

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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/toisostring/index.html b/files/ca/web/javascript/reference/global_objects/date/toisostring/index.html new file mode 100644 index 0000000000..759e53225c --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/toisostring/index.html @@ -0,0 +1,134 @@ +--- +title: Date.prototype.toISOString() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/toISOString +translation_of: Web/JavaScript/Reference/Global_Objects/Date/toISOString +--- +
{{JSRef}}
+ +

El mètode toISOString() retorna una cadena en un format ISO extès simplificat (ISO 8601), el qual sempre té 24 caràcters de llargària: YYYY-MM-DDTHH:mm:ss.sssZ. La zona horària és sempre UTC, tal i com indica el sufix "Z".

+ +

Sintaxi

+ +
dateObj.toISOString()
+ +

Exemples

+ +

Utilitzar toISOString()

+ +
var today = new Date('05 October 2011 14:48 UTC');
+
+console.log(today.toISOString()); // Retorna 2011-10-05T14:48:00.000Z
+
+ +

L'exemple anterior interpreta una cadena no estàndard que pot no ser interpretada correctament per navegadors que no siguin mozilla.

+ +

Polyfill

+ +

Aquest mètode es va estandaritzar en la 5a edició d'ECMA-262. Els motors que no s'hagin actualitzat per suportar aquest mètode poden evitar al mancança d'aquest mètode utilitzant les següents accions:

+ +
if (!Date.prototype.toISOString) {
+  (function() {
+
+    function pad(number) {
+      if (number < 10) {
+        return '0' + number;
+      }
+      return number;
+    }
+
+    Date.prototype.toISOString = function() {
+      return this.getUTCFullYear() +
+        '-' + pad(this.getUTCMonth() + 1) +
+        '-' + pad(this.getUTCDate()) +
+        'T' + pad(this.getUTCHours()) +
+        ':' + pad(this.getUTCMinutes()) +
+        ':' + pad(this.getUTCSeconds()) +
+        '.' + (this.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) +
+        'Z';
+    };
+
+  }());
+}
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES5.1', '#sec-15.9.5.43', 'Date.prototype.toISOString')}}{{Spec2('ES5.1')}}Definició inicial. Implementat en JavaScript 1.8.
{{SpecName('ES6', '#sec-date.prototype.toisostring', 'Date.prototype.toISOString')}}{{Spec2('ES6')}} 
+ +

Compatibilitat amb navegadors

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

Vegeu també

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/tojson/index.html b/files/ca/web/javascript/reference/global_objects/date/tojson/index.html new file mode 100644 index 0000000000..8b583470bf --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/tojson/index.html @@ -0,0 +1,108 @@ +--- +title: Date.prototype.toJSON() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/toJSON +translation_of: Web/JavaScript/Reference/Global_Objects/Date/toJSON +--- +
{{JSRef}}
+ +

El mètode toJSON() retorna una representació de tipus cadena de l'objecte {{jsxref("Date")}}.

+ +

Sintaxi

+ +
dateObj.toJSON()
+ +

Descripció

+ +

Les instàncies {{jsxref("Date")}} referencien a un punt concret en el temps. La crida toJSON() retorna una cadena (usant {{jsxref("Date.prototype.toISOString()", "toISOString()")}}) en representació del valor de l'objecte {{jsxref("Date")}}. Generalment aquest mètode s'utilitza, per defecte, per serialitzar eficaçment objectes {{jsxref("Date")}} durant la serialització {{Glossary("JSON")}}.

+ +

Exemples

+ +

Utilitzar toJSON()

+ +
var jsonDate = (new Date()).toJSON();
+var backToDate = new Date(jsonDate);
+
+console.log(jsonDate); //2015-10-26T07:46:36.611Z
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES5.1', '#sec-15.9.5.44', 'Date.prototype.toJSON')}}{{Spec2('ES5.1')}}Definició inicial. Implementat en JavaScript 1.8.5.
{{SpecName('ES6', '#sec-date.prototype.tojson', 'Date.prototype.toJSON')}}{{Spec2('ES6')}} 
+ +

Compatibilitat amb navegadors

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

Vegeu també

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/tostring/index.html b/files/ca/web/javascript/reference/global_objects/date/tostring/index.html new file mode 100644 index 0000000000..8482fe5298 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/tostring/index.html @@ -0,0 +1,142 @@ +--- +title: Date.prototype.toString() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/toString +translation_of: Web/JavaScript/Reference/Global_Objects/Date/toString +--- +
{{JSRef}}
+ +

El mètode toString() retorna un string que representa l'objecte {{jsxref("Date")}} especificat.

+ +

Sintaxi

+ +
objecteDate.toString()
+ +

Paràmetres

+ +

Cap.

+ +

Descripció

+ +

L'objecte {{jsxref("Date")}} sobreescriu el mètode toString() de l'objecte {{jsxref("Object")}}; no hereta {{jsxref("Object.prototype.toString()")}}. Per a objectes {{jsxref("Date")}}, el mètode toString() retorna un string que representa l'objecte.

+ +

El mètode toString() sempre retorna una representació en forma de string de la data en anglés americà.

+ +

JavaScript cridarà el mètode toString() de manera automàtica quan una data requereix ser representada com a text o bé quan una data formi part d'una concatenació de strings.

+ +

El mètode toString() és genèric. Si this no fa referència a una instància de {{jsxref("Date")}}, retornarà "Invalid Date".

+ +

Exemples

+ +

Utilitzar toString()

+ +

L'exemple següent assigna el valor de toString() d'un objecte {{jsxref("Date")}} a myVar:

+ +
var x = new Date();
+myVar = x.toString(); // assigna un valor a myVar simimlar a:
+// Mon Sep 28 1998 14:36:22 GMT-0700 (Pacific Daylight Time)
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.9.5.2', 'Date.prototype.toLocaleTimeString')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.tostring', 'Date.prototype.toString')}}{{Spec2('ES6')}} 
+ +

Compatibilitat amb navegadors

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
Mètode genèric{{CompatUnknown}}{{CompatGeckoDesktop("41")}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
Mètode genèric{{CompatUnknown}}{{CompatUnknown}}{{CompatGeckoMobile("41")}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
+
+ +

Vegeu també

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/totimestring/index.html b/files/ca/web/javascript/reference/global_objects/date/totimestring/index.html new file mode 100644 index 0000000000..aac8de7a85 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/totimestring/index.html @@ -0,0 +1,115 @@ +--- +title: Date.prototype.toTimeString() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/toTimeString +translation_of: Web/JavaScript/Reference/Global_Objects/Date/toTimeString +--- +
{{JSRef}}
+ +

El mètode toTimeString() retorna la part de temps d'un objecte de tipus {{jsxref("Date")}} formatada de tal forma que és entenible per les persones, utilitzan anglés americà.

+ +

Sintaxi

+ +
objecteData.toTimeString()
+ +

Descripció

+ +

Les instàncies de {{jsxref("Date")}} representen un punt específic en el temps. Una crida al mètode {{jsxref("Date.prototype.toString()", "toString()")}} retornarà la dada en un format entenible per persones, en anglés americà. Al motor SpiderMonkey, aquest format consisteix en la part de la data (dia, mes i any) seguida de la part de l'hora (hores, minuts, segons i zona horària). De vegades és convenient obtenir un string només de la part de l'hora; aquesta és la raó de ser del mètode toTimeString().

+ +

El mètode toTimeString() resulta especialment útil perquè els motors que compleixen amb el standard ECMA-262 poden retornar resultats diferents al string obtingut mitjançant el mètode {{jsxref("Date.prototype.toString()", "toString()")}} en objectes {{jsxref("Date")}}, ja que el format depèn totalment de la implementació; això implica que partir el string per a obtenir només la part de temps pot no produïr un resultat consistent en tots els motors.

+ +

Exemples

+ +

Utilització bàsica de toTimeString()

+ +
var d = new Date(1993, 6, 28, 14, 39, 7);
+
+console.log(d.toString());     // escriu Wed Jul 28 1993 14:39:07 GMT-0600 (PDT)
+console.log(d.toTimeString()); // escriu 14:39:07 GMT-0600 (PDT)
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES3')}}{{Spec2('ES3')}}Definició inicial.
{{SpecName('ES5.1', '#sec-15.9.5.4', 'Date.prototype.toTimeString')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.totimestring', 'Date.prototype.toTimeString')}}{{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é

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/utc/index.html b/files/ca/web/javascript/reference/global_objects/date/utc/index.html new file mode 100644 index 0000000000..37bb2bc369 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/utc/index.html @@ -0,0 +1,142 @@ +--- +title: Date.UTC() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/UTC +translation_of: Web/JavaScript/Reference/Global_Objects/Date/UTC +--- +
{{JSRef}}
+ +

El mètode Date.UTC() accepta els mateixos paràmetres que la forma més llarga del constructor, i retorna en un objecte de tipus {{jsxref("Date")}} el nombre de milisegons que han passat des de l'u de gener de 1970 a les 00:00:00, temps universal.

+ +

Sintaxi

+ +
Date.UTC(any, mes[, dia[, hora[, minuts[, segons[, milisegons]]]]])
+ +

Paràmetres

+ +
+
any
+
Un any major que 1900.
+
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.
+
hora
+
Opcional. Un nombre sencer entre 0 i 23 que representa l'hora.
+
minuts
+
Opcional. Un nombre sencer entre 0 i 59 que representa els minuts.
+
segons
+
Opcional. Un nombre sencer entre 0 i 59 que representa els segons.
+
milisegons
+
Opcional. Un nombre sencer entre 0 i 999 que representa els milisegons.
+
+ +

Descripció

+ +

UTC() accepta una data en forma de paràmetres separats per comes i retorna el nombre de milisegons que han passat entre l'u de gener de 1970 a les 00:00:00 en temps universal, i el temps especificat pels paràmetres.

+ +

L'any ha de ser especificat plenament; per exemple, 1998. Si s'especifica un any entre 0 i 99, el mètode el converteix a un any del segle 20 (1900 + any); per exemple, si s'especifica 95, s'emprarà l'any 1995.

+ +

El mètode UTC() es diferencia del constructor {{jsxref("Date")}} en dues coses.

+ + + +

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.

+ +

Com que UTC() és un mètode estàtic de {{jsxref("Date")}}, sempre es crida com a Date.UTC() en comptes de com un mètode d'una instància de {{jsxref("Date")}}.

+ +

Exemples

+ +

Utilitzar Date.UTC()

+ +

La instrucció següent crea un objecte {{jsxref("Date")}} utilitzant temps UTC en comptes del temps local:

+ +
var dataUTC = new Date(Date.UTC(96, 11, 1, 0, 0, 0));
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES6', '#sec-date.utc', 'Date.UTC')}}{{Spec2('ES6')}} 
{{SpecName('ES5.1', '#sec-15.9.4.3', 'Date.UTC')}}{{Spec2('ES5.1')}} 
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.0.
+ +

Compatibilitat amb navegadors

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

Vegeu també

+ + diff --git a/files/ca/web/javascript/reference/global_objects/date/valueof/index.html b/files/ca/web/javascript/reference/global_objects/date/valueof/index.html new file mode 100644 index 0000000000..6c5f810ead --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/date/valueof/index.html @@ -0,0 +1,118 @@ +--- +title: Date.prototype.valueOf() +slug: Web/JavaScript/Referencia/Objectes_globals/Date/valueOf +translation_of: Web/JavaScript/Reference/Global_Objects/Date/valueOf +--- +
{{JSRef}}
+ +

El mètode valueOf() retorna el valor primitiu d'un objecte de tipus {{jsxref("Date")}}.

+ +

Sintaxi

+ +
dateObj.valueOf()
+ +

Paràmetres

+ +

Cap.

+ +

Descripció

+ +

El mètode valueOf() retorna el valor primitiu d'un objecte de tipus {{jsxref("Date")}} en forma de nombre, el nombre de milisegons des de la mitjanit de l'ú de gener de 1970 UTC.

+ +

Aquest mètode és funcionalment equivalent al mètode {{jsxref("Date.prototype.getTime()")}}.

+ +

Aquest mètode és tot sovint emprat internament per JavaScript i no explícitament en codi.

+ +

Exemples

+ +

Utilitzar valueOf()

+ +
var x = new Date(56, 6, 17);
+var myVar = x.valueOf();      // assigna -424713600000 a myVar
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.1.
{{SpecName('ES5.1', '#sec-15.9.5.8', 'Date.prototype.valueOf')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.valueof', 'Date.prototype.valueOf')}}{{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