Incrementing a date in JavaScript

后端 未结 17 2413
余生分开走
余生分开走 2020-11-22 05:15

I need to increment a date value by one day in JavaScript.

For example, I have a date value 2010-09-11 and I need to store the date of the next day in a JavaScript v

17条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 05:47

    The easiest way is to convert to milliseconds and add 1000*60*60*24 milliseconds e.g.:

    var tomorrow = new Date(today.getTime()+1000*60*60*24);
    

提交回复
热议问题