Convert Json date string to JavaScript date object
- by dagda1
Hi,
I have the following JSON object which has a date field in the following format:
{
"AlertDate": "\/Date(1277334000000+0100)\/",
"Progress": 1,
"ReviewPeriod": 12
}
I want to write a regular expression or a function to convert it to a javascript object so that it is in the form:
{
"AlertDate": "AlertDate":new Date(1277334000000),
"Progress": 1,
"ReviewPeriod": 12
}
The above date format fails validation in the JQuery parseJSON method.
I would like to convert the 1277334000000+0100 into the correct number of milliseconds to create the correct date when eval is called after validation.
Can anyone help me out with a good approach to solving this?
Cheers
Paul