MySQL - extraction time in correct format

I have a table with a coloumn of type "time" and the values ​​in this coloumn are stored like this: 20:45:00, 18:00:00, etc.

Now when you show the result, I am not getting the minutes, but only 00. I use the following to get the time:

SELECT TIME_FORMAT(time, '%h:%m') as time FROM ......... etc

      

+2


a source to share


1 answer


This is because% m responds against month, not minutes. % I answer for minutes:



select
    time_format(`time`, '%H:%i') as time
from
    ...

      

+5


a source







All Articles