English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
toJSON()The method returns the string representation of a date object in JSON date format.
JSON dates have the same format as ISO-8601Format with the same standard: YYYY-MM-DDTHH:mm:ss.sssZ
date.toJSON()
var d = new Date(); var str = d.toJSON(); document.getElementById('result').innerHTML = str;Test See‹/›
The numbers in the table specify the first browser version that fully supports the toJSON() method:
Method | |||||
toJSON() | 4 | 3.5 | Yes | Yes | 9 |
Return Value: | A string representing a date and time in JSON date format |
---|---|
JavaScript Version: | ECMAScript 5 |