Home >Web Front-end >JS Tutorial >Function to convert date in json format into Javascript object_javascript skills

Function to convert date in json format into Javascript object_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:23:261003browse
Copy code The code is as follows:

//Convert the date in json format (such as: {ServerDatetime:"/ Date(1278930470649)/"}) is the date object of Javascript
function ConvertJSONDateToJSDateObject(JSONDateString) {
var date = new Date(parseInt(JSONDateString.replace("/Date(", "").replace(" )/", ""), 10));
return date;
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn