Convert a JSON date string to a javascript date object

JSON formats strings in the format;


which cannot be directly parsed into a javascript date object using new Date

Related tags: JavaScript

Credit: Original Poster

The following function can be used:

function ConvertJSONDateToDate(jsonDate) {
    var dateSlice = jsonDate.slice(6, 24);
    var milliseconds = parseInt(dateSlice);
    var date = new Date(milliseconds);

    return date;

Rating: 1002

Propose a different solution...