From 4b1a9203c547c019fc5398082ae19a3f3d4c3efe Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:41:15 -0500 Subject: initial commit --- .../global_objects/date/tojson/index.html | 81 ++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 files/de/web/javascript/reference/global_objects/date/tojson/index.html (limited to 'files/de/web/javascript/reference/global_objects/date/tojson') diff --git a/files/de/web/javascript/reference/global_objects/date/tojson/index.html b/files/de/web/javascript/reference/global_objects/date/tojson/index.html new file mode 100644 index 0000000000..1d65876585 --- /dev/null +++ b/files/de/web/javascript/reference/global_objects/date/tojson/index.html @@ -0,0 +1,81 @@ +--- +title: Date.prototype.toJSON() +slug: Web/JavaScript/Reference/Global_Objects/Date/toJSON +tags: + - Date + - JavaScript + - Methode(2) + - Prototype + - Referenz +translation_of: Web/JavaScript/Reference/Global_Objects/Date/toJSON +--- +
{{JSRef}}
+ +

Die toJSON() Methode gibt einen String zurück, der das {{jsxref("Date")}} Objekt darstellt.

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

Syntax

+ +
dateObj.toJSON()
+ +

Rückgabewert

+ +

Ein String, der das gegebene date Objekt repräsentiert.

+ +

Beschreibung

+ +

{{jsxref("Date")}} Instanzen repräsentieren einen bestimmten Zeitpunkt. Ein Aufruf von toJSON() gibt unter Verwendung von {{jsxref("Date.prototype.toISOString()", "toISOString()")}} einen String zurück, der den Wert des {{jsxref("Date")}} Objekts darstellt. Diese Methode ist dafür vorgesehen, {{jsxref("Date")}} Objekte während der {{Glossary("JSON")}} Serialisierung standardisiert zu serialisieren.

+ +

Beispiele

+ +

Einsatz von toJSON()

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

Spezifikationen

+ + + + + + + + + + + + + + + + + + + + + + + + +
SpezifikationStatusBemerkung
{{SpecName('ES5.1', '#sec-15.9.5.44', 'Date.prototype.toJSON')}}{{Spec2('ES5.1')}}Erstmalige Definition. Implementiert in JavaScript 1.8.5.
{{SpecName('ES6', '#sec-date.prototype.tojson', 'Date.prototype.toJSON')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-date.prototype.tojson', 'Date.prototype.toJSON')}}{{Spec2('ESDraft')}} 
+ +

Browserkompatibilität

+ + + +

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

+ +

Siehe auch

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