Easy Tutorial
❮ Met Canvas Beginpath Event Ondrop ❯

JavaScript toJSON() Method

JavaScript Date Object

Example

Returns the Date object as a string, formatted as JSON data:

n Output result:


Definition and Usage

The toJSON() method converts a Date object into a string, formatted as JSON data format.

JSON data uses the same format as the ISO-8601 standard: YYYY-MM-DDTHH:mm:ss.sssZ


Browser Support

All major browsers support the toJSON() method.

Note: Internet Explorer 8 and earlier versions do not support this method.


Syntax

Return Value

Type Description
String Date in JSON data format

Technical Details

| JavaScript Version: | 1.8.5 | | --- | --- |


JavaScript Date Object

❮ Met Canvas Beginpath Event Ondrop ❯