Convert to JSON

suggest change
const date1 = new Date();
date1.toJSON();

For a valid date, toJSON() returns the same string as toISOString(). The value below is an example of that format, not the result of new Date() at an arbitrary time.

Example: ā€œ2016-04-14T23:49:08.596Zā€

toJSON() throws RangeError on an invalid date.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents