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/tojson/index.html | 108 +++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 files/ca/web/javascript/reference/global_objects/date/tojson/index.html (limited to 'files/ca/web/javascript/reference/global_objects/date/tojson/index.html') 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é

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