开发者

MySQL - Extracting Time in correct format

开发者 https://www.devze.com 2022-12-27 21:58 出处:网络
I have a table with a coloumn of type \"time\", and the values in this coloumn are stored as follows: 20:45:00, 18:00:00, etc.

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

Now when displaying the result, I am not getting the minutes, but just 00. I am using the following to get t开发者_Go百科he time:

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


That's because %m answers against month - and not minutes. %i answers to minutes:

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

精彩评论

暂无评论...
验证码 换一张
取 消