Tom
Tom

Reputation: 12998

MySQL - Select where timestamp is midnight

I have a table with a timestamp column in it and I want to select any rows of any date where the time is 00:00:00

Is there a better way to do this other than filtering on the last 8 characters as a substring?

Upvotes: 0

Views: 977

Answers (1)

Tom
Tom

Reputation: 6663

Use the TIME() function.

WHERE TIME(yourfield) = '00:00:00'

Upvotes: 4

Related Questions