How to convert MySQL DATETIME value to JSON format in JavaScript?

To convert, use JSON.stringify(). Following is the code to convert MySQL DATETIME value to JSON format in JavaScript −

The screenshot of the code is as follows −

This will produce the following output −

{"year" :2019,"month" :8,"DateValue" :6,"Hour" :22,"Minutes" :54,"Second" :48}

The snapshot of the output is as follows −

Updated on: 2019-10-07T10:49:22+05:30

706 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements