Is the Javascript date object always one day off?

后端 未结 23 2328
既然无缘
既然无缘 2020-11-22 01:49

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

23条回答
  •  爱一瞬间的悲伤
    2020-11-22 02:12

    If you want to get hour 0 of some date in the local time zone, pass the individual date parts to the Date constructor.

    new Date(2011,08,24); // month value is 0 based, others are 1 based.
    

提交回复
热议问题