Home > Web Front-end > JS Tutorial > body text

Function to convert date in json format into Javascript object_javascript skills

WBOY
Release: 2016-05-16 18:23:26
Original
976 people have browsed it
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;
}
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template