To convert the datetime to JSON format /Date(#)/ is pretty simple. You can use the following function that will accept a string of date and will convert it as a date object and return as a string json format.
Alternatively, you can use our free JSON datetime converter to help you convert the time to readable datetime.
function convertToJSONDate(strDate){ var dt = new Date(strDate); var newDate = new Date(Date.UTC(dt.getFullYear(), dt.getMonth(), dt.getDate(), dt.getHours(), dt.getMinutes(), dt.getSeconds(), dt.getMilliseconds())); return '/Date(' + newDate.getTime() + ')/'; }
Example on how to use it:
convertToJSONDate("22 Jan 2013 15:00:00"); /* and this should return the following value:*/ /Date(1358866800000)/