I have a input field fromDate on focusing on the input field it will open a calendar to select the date and after selecting the date I want to convert the date to json date. For e.g I select the date as 21/03/2014 but while converting it to json date it is taking as 20th March 2014:
Below is my code
var fromDate = $("#fromDate").datepicker("getDate");
alert(fromDate);
var dd = fromDate.toJSON();
alert(dd);
the alert from date is showing as Fri Mar 21 2014 00:00:00 GMT+0530(India Standard Time)
and after converting it to fromDate.toJSON() it is showing as 2014-03-20T18:30:00:000Z
But after converting to json date I want it should show 21st, could you help me why it is taking previous date and please tell me the solution