I have a strange problem in json date parsing. I am using the following to parse the json date:
dateFormat(new Date(parseInt(user.RegDate.substr(6))), "mm/dd/yyyy")
When my local machine (Client) is in different timezone from the server timezone, then it returns different dates when i try to retrieve the registered date of the users.
For ex.:
Registered date in SQL: 2010-07-22 19:00:00.000
When i debug in local machine which is in IST Timezone, the dates from JsonResult returned are:
/Date(1279805400000)/
Thu Jul 22 19:00:00 UTC+0530 2010
The same data when i access it from the deployed server which is in EST timezone, the dates from JsonResult returned are:
/Date(1279843200000)/
Fri Jul 23 05:30:00 UTC+0530 2010
This works perfect (returns same date - Thu Jul 22) when i change my local machine to EST Timezone. Am i missing anything here?. Please suggest
The Server Code is [EDIT]:
public JsonResult GetregisteredUsersJSON()
{
var usersList = this.GetregisteredUsers()
return Json(usersList, JsonRequestBehavior.AllowGet);
}
private List<Users> GetregisteredUsers()
{
return (from u in _context.mu_Users
orderby u.Reg_Date descending
select new Users
{
FirstName = u.First_Name,
LastName = u.Last_Name,
RegDate = u.Reg_Date
}).ToList();
}