Eugene Ganancial
Eugene Ganancial

Reputation: 5

How to select data with overdue dates? Mysql

I wanted to select data which has an overdue dates. For example, Deadline is 9-9-2016 and the date today is 10-10-2016. Clearly 9-9-2016 is already overdue. Thanks.

Upvotes: 0

Views: 3788

Answers (2)

Cristian Greco
Cristian Greco

Reputation: 2596

Have a look at the date and time functions in MySql. Depending on the type of your column, you may want to use something like CURRENT_DATE() or CURRENT_TIME():

select * from mytable where mydate < CURRENT_DATE()

Upvotes: 1

Evgeny
Evgeny

Reputation: 4010

Well, you can try to use NOW() function in where clause to check overdue dates. Somethisn like this:

select * from your_table where your_date < NOW()

Also you can try use CURDATE() instead of NOW().

Upvotes: 1

Related Questions