I am calling a .net asmx webservice that returns a number of fields. One of the fields in a date. The date is in the format of: "effective_date":"\/Date(978411600000)\/"
According to this SO question: How do I format a Microsoft JSON date? it would be better if the date returned was in ISO 8601 format, this way JavaScript would be able to interpret it as a date.
Currently I use the following javascript: new Date(d.effective_date)
and I get the message Invalid Date
. According to the linked SO question I should be able to do this if I can get the web service to pass the date in ISO format rather than in \/Date(978411600000)\/
format.
My question is, how do I get the webservice to return the date in ISO 8601 format?
Note:
I'm aware that I can use this (per the answer from the linked question): var date = new Date(parseInt(d.effective_date.substr(6)));
, however it is mentioned in a comment that Incoming date values should be formatted in ISO-8601
, so I'm wondering how to get the incoming date from the web service to be in this ISO format.