Selecting entries by date - >= NOW(), MySQL

前端 未结 6 1062
盖世英雄少女心
盖世英雄少女心 2020-12-13 14:11

I have a Calendar of Events table and I would like to select events with dates equal to or greater than today. When I use the following SELECT statement, it only retrieves e

6条回答
  •  [愿得一人]
    2020-12-13 14:50

    You could also do

    query("SELECT * FROM events WHERE UNIX_TIMESTAMP(event_date) >=     UNIX_TIMESTAMP(NOW())");
    ?>
    

    Which is more accurate than using CURTIME() if by any chance your using time as well as date

提交回复
热议问题