From a55b575e8089ee6cab7c5c262a7e6db55d0e34d6 Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 14:46:50 +0100 Subject: unslug es: move --- .../global_objects/date/tojson/index.html | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 files/es/web/javascript/reference/global_objects/date/tojson/index.html (limited to 'files/es/web/javascript/reference/global_objects/date/tojson/index.html') diff --git a/files/es/web/javascript/reference/global_objects/date/tojson/index.html b/files/es/web/javascript/reference/global_objects/date/tojson/index.html new file mode 100644 index 0000000000..7d44a716c2 --- /dev/null +++ b/files/es/web/javascript/reference/global_objects/date/tojson/index.html @@ -0,0 +1,61 @@ +--- +title: Date.prototype.toJSON() +slug: Web/JavaScript/Referencia/Objetos_globales/Date/toJSON +translation_of: Web/JavaScript/Reference/Global_Objects/Date/toJSON +--- +
{{JSRef}}
+ +

El metodo toJSON() retorna una representacion de cadena del objeto {{jsxref("Date")}}

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

Syntaxis

+ +
dateObj.toJSON()
+ +

Valor retornado

+ +

Una representación de cadena de la fecha dada.

+ +

Descripción

+ +

{{jsxref("Date")}} las instancias se refieren a un momento específico en el tiempo. Llamando a toJSON() retorna un string (usando {{jsxref("Date.prototype.toISOString()", "toISOString()")}}) representando el {{jsxref("Date")}} valor del objeto. Este método generalmente está destinado, de forma predeterminada, a serializar de manera útil {{jsxref("Date")}} objetos durante la serialización JSON .

+ +

Ejemplos

+ +

Usando toJSON()

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

Especificaciones

+ + + + + + + + + + +
Especificación
{{SpecName('ESDraft', '#sec-date.prototype.tojson', 'Date.prototype.toJSON')}}
+ +

Compatibilidad en buscadores

+ + + +

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

+ +

Ver también

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