I'm trying see dates based off of some json data I have.
My code is:
var date = new Date(json.events[i].event.first_date);
alert(date);
Now, that json.events[i].event.first_date
just returns the date in the format of yyyy-mm-dd
.
I noticed, however that when I do the alert(date);
, I'm shown the day before the date that the actual data says.
For example, json.events[0].event.first_date
gives the date 2015-06-02
but the alert shows June 1, 2015.
I am getting my json from a url based somewhere in Germany and I am in the US. Could the date be messed up because of timezones?