new Date(new Date().getTime()-25 * 24 * 60 * 60 * 1000) got unexpected date

后端 未结 3 1279
小鲜肉
小鲜肉 2021-01-21 19:24

I would like to generate a list of dates, but found out the date is wrong start from - 25 * 24 * 60 * 60 * 1000

My local date is 2016-07-17. I got

2016-         


        
3条回答
  •  無奈伤痛
    2021-01-21 19:52

    Integer overflow.

    Multiplying 25 * 24 * 60 * 60 * 1000 results in 2160000000 which is more than what fits in an integer.

提交回复
热议问题