I'm using datepicker in an input form, and sending the results through json to a database. I am using this line, to get the date from the datePicker:
date = $("#datepicker").datepicker('getDate');
Now, I would expect this to return 2014-04-03T00:00:00.000Z
But in fact it returns 2014-04-02T22:00:00.000Z
Notice the two hour difference, which unintentionally changes the day of month as well. I have no use for the hours and the smaller time units. However I do want the date to be right, without adding a dreaded +1
to my code. I suspect this has something to do with time zones, but I can't seem to find a solution to it in the documentation, or other Q&A's online. Could anyone point me in the right direction? My time zone is GMT +1 if that matters.
Thanks :)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…