Skip to content
Advertisement

Always round set seconds / minutes /hours to 00 mysql

In my database I have the following date-times:

I want to be able to retrieve these records with the hours, minutes or seconds set to their 00 values:

For example I want to be able to return records with seconds and milliseconds set to 00:

Or return them setting the minutes to zero as well.

How can I write a query to format my results as desired?

I tried :

This returns the result with seconds set to 00 so im getting closer

Advertisement

Answer

If you know which parts of the time you want to get as zero then a simple

will return

Or

will return

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement