I have a webservice that returns for example a DateTime object: DepartureDate. I use ajax to fetch this and in my view I convert the JSON date string to a javascript date object with this function:
function convertToDate(jsonDate) {
return eval("new " + jsonDate.substring(1, jsonDate.length - 1));
}
The problem is that new Date()
takes the local time on the clients computer in consideration, so clients in different countries get different dates. I want to get the exact date that was returned from the webservice.
Is there any easy way to accomplish this?