Get tomorrow's date with getDay Javascript

前端 未结 2 1645
南笙
南笙 2021-01-05 11:03

What I am making is a weather forecast website, and what I need is the days of the week (ie. \"Sunday\", \"Monday\", etc.). To get tomorrow\'s date I am just putting \"+ 1\"

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-05 11:36

    Use (day.getDay() + i) % 7. That will only return results between 0-6.

提交回复
热议问题