JavaScript Convert to JSON


Example

var date1 = new Date();
date1.toJSON();

Returns: "2016-04-14T23:49:08.596Z"