I retrieved a date from my database table which was of the format : DD-MM-YYYY HH:MM:SS.FFF
and saved it in a dynamic variable which was then passed to the JavaScriptSerializer class to make it a JSON object and I got the format: "\/Date(1394841600000)\/"
for the date. I'm not sure why this is ing and I cant find this format in any of the standard date format lists.
Can anyone tell me what this format is? Or better, how to parse this to get my original format back using javascript?
I retrieved a date from my database table which was of the format : DD-MM-YYYY HH:MM:SS.FFF
and saved it in a dynamic variable which was then passed to the JavaScriptSerializer class to make it a JSON object and I got the format: "\/Date(1394841600000)\/"
for the date. I'm not sure why this is ing and I cant find this format in any of the standard date format lists.
Can anyone tell me what this format is? Or better, how to parse this to get my original format back using javascript?
Share Improve this question edited Mar 19, 2014 at 6:38 Mkl Rjv asked Mar 18, 2014 at 10:25 Mkl RjvMkl Rjv 6,9335 gold badges32 silver badges48 bronze badges3 Answers
Reset to default 5It is date in ticks since midnight Jan 1, 1970 to the date of object.
To convert use:
var myDate = new Date("/Date(1394841600000)/".match(/\d+/)[0] * 1);
Here is Demo
Try this :
var myDate = new Date(parseInt('/Date(1354348015481)/'.substr(6)));
The format is milliseconds from UNIX epoch. What you see is basically a JSON friendly variant of new Date(1394841600000)
. For example try this:
var date = new Date(1394841600000);
console.log(date);