Show records from now() till next 7 days in mysql

前端 未结 5 659
清歌不尽
清歌不尽 2020-12-29 07:22

I want to select rows from the datetime now till 7 days in the future, how can I do this? Read alot about the date function of mysql but cant figure it out, this is the MySQ

5条回答
  •  不知归路
    2020-12-29 08:10

    I would submit that the most elegant way would be:

    WHERE `date` BETWEEN NOW() AND DATE_ADD(NOW(), INTERVAL 7 DAY)
    

    Edit: this doc page is like the most useful thing ever. Bookmark it, because it is totally handy.

提交回复
热议问题