Date.prototype.toJSON

Used by JSON.stringify to transform Date into a string for representing in JSON.

Syntax

toJSON()