a toJSON () method converts the Date object as a string, and data formatted as JSON format.

JavaScript  toJSON () method

 

Definition and Usage

a toJSON () method may be converted to a string Date object, and data formatted as JSON format .

JSON data with the same format as a standard x ISO-8601: YYYY-MM-DDTHH: mm: ss.sssZ

 


 

Examples

Date object character string, and data formatted as JSON:

var d=new Date();
var n=d.toJSON();

n  output:

2019-11-18T06:54:55.498Z

Guess you like

Origin www.cnblogs.com/kaiqinzhang/p/11882163.html