Asim Shahzad Asim Shahzad - 1 year ago 80
MySQL Question

MySQL SELECT WHERE datetime matches time (and not necessarily day)

I have a table which contains a timestamp column. I wish to return all records of a given time regardless of the date.

In other words i want to fetch all records where time is greater then 09:43:00

2015-11-02 09:41:43
2015-11-02 09:43:02
2015-11-02 09:48:27
2015-11-02 09:52:49

Answer Source

Try this:

SELECT * FROM <table_name>
WHERE date_format(timestamp_col,'%H:%i:%s') > '09:43:00'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download