Asim Shahzad Asim Shahzad - 10 months ago 41
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


Try this:

SELECT * FROM <table_name>
WHERE date_format(timestamp_col,'%H:%i:%s') > '09:43:00'