In my Java Script app I have the date stored in a format like so:
2011-09-24
Now when I try using the above value to create a new Date obje
Your issue is specifically with time zone. Note part GMT-0400
- that is you're 4 hours behind GMT. If you add 4 hours to the displayed date/time, you'll get exactly midnight 2011/09/24. Use toUTCString()
method instead to get GMT string:
var doo = new Date("2011-09-24");
console.log(doo.toUTCString());