Javascript parsing json date timezone return one day earlier in British Standard Time -
i have used below code date.
function parsejsondate(jsondate, dateformat) { var offset = new date().gettimezoneoffset() * 60000; var parts = /\/date\((-?\d+)([+-]\d{2})?(\d{2})?.*/.exec(jsondate); if (typeof dateformat == 'undefined') { dateformat = 'mm/dd/yyyy h:mm'; } if (parts[2] == undefined) parts[2] = 0; if (parts[3] == undefined) parts[3] = 0; return new date(+parts[1] + offset + parts[2] * 3600000 + parts[3] * 60000).format(dateformat); };
but function returns 1 day earlier in british standard time. while input json date in correct. can me fix issue.
Comments
Post a Comment