The toJSON() method converts a Date object a JSON date in string.
The toJSON() method converts a Date object a JSON date in string.
JSON dates use the the ISO-8601 standard format: YYYY-MM-DDTHH:mm:ss.sssZ
Date.toJSON()
A String, representing the date and time formatted as a JSON date
Return a Date object as a String, formatted as a JSON date:
//display the date and time as a string, formatted as a JSON date. var d = new Date(); var n = d.toJSON(); console.log(n);/*from w w w . j ava 2 s .co m*/