Format JSON Datetime on client side by Javascript or Jquery
javascript, jquery, json
Solution
var date = new Date(parseInt(dateTime.substr(6)));
var formatted = date.getFullYear() + "-" +
("0" + (date.getMonth() + 1)).slice(-2) + "-" +
("0" + date.getDate()).slice(-2) + " " + date.getHours() + ":" +
date.getMinutes();
Problem
Possible Duplicate: Convert a date to string in Javascript I have date in json format at client side : ``` /Date(1352745000000)/ ``` The code which i have tried to parse Json date: ``` eval(dateTime.replace(/\/Date\((\d+)\)\//gi, "new Date($1)")); ``` and ``` new Date(parseInt(dateTime.substr(6))); ``` Out put I am getting: ``` Tue Nov 27 2012 00:00:00 GMT+0530 (India Standard Time) ``` Desire Output ``` 2012-11-27 11:16 ``` I am not able to figure out how we will get this.