Name
Date.toJSON — JSON-serialize a Date object
Availability
ECMAScript 5
Synopsis
date
.
toJSON
(
key
)
Arguments
key
JSON.stringify()
passes this argument, but thetoJSON()
method ignores it.
Returns
A string representation of the date, obtained by calling its
toISOString()
method.
Description
This method is used by JSON.stringify()
to convert a Date object
to a string. It is not intended for general use.
See Also
Get JavaScript: The Definitive Guide, 6th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.