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

前端 未结 5 638
清歌不尽
清歌不尽 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条回答
  •  旧时难觅i
    2020-12-29 07:49

    You could use the INTERVAL modifier to add a week to the current time as follows:

    ...WHERE date >= NOW() AND date <= NOW() + INTERVAL 7 DAY;
    

提交回复
热议问题