Datetime equal or greater than today in MySQL
Answer marked is misleading. The question stated is DateTime
, but stated what was needed was just CURDATE()
.
The shortest and correct answer to this is:
SELECT * FROM users WHERE created >= CURRENT_TIMESTAMP;
SELECT * FROM users WHERE created >= NOW();
if the column is datetime type.
SELECT * FROM myTable WHERE DATE(myDate) = DATE(NOW())
Read more: http://www.tomjepson.co.uk/tutorials/36/mysql-select-where-date-today.html
SELECT * FROM users WHERE created >= CURDATE();
But I think you mean created < today
You can compare datetime with date, for example: SELECT NOW() < CURDATE()
gives 0
, SELECT NOW() = CURDATE()
gives 1
.