Why does JavaScript show me one day before my set date?
This question already has an answer here:
When you create date from string without timezone you get a date + timezone correction – if you're in USA then you have something like GMT-7 and you get the second of June minus 7 hours – the previous day. Try splitting your date and use new Date(2015, 7, 1)
constructor and you'll get date you're expecting. String parse reference docs -https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date/parse
上一篇: 关于Java规范的理解困难