mysql 12 hr到24 hr时间转换 [英] mysql 12 hr to 24 hr time conversion
本文介绍了mysql 12 hr到24 hr时间转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们如何将AM/PM的时间转换为24小时格式.例如. (1:30 PM)应该转换为(13:30).
How can we convert the time in AM/PM to 24-hrs format. For eg. (1:30 PM) should be converted to (13:30).
推荐答案
日期/时间以相同的方式存储在mysql中,而不管它们如何格式化.
Dates / Times are stored in mysql the same way regardless of how they are formatted.
我相信您要做的是以指定格式检索日期.
I believe what you want to do is retrieve the date in a specified format.
DATE_FORMAT()将为您完成此操作.
The DATE_FORMAT() will do this for you.
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format
%r和%T分别是12小时和24小时制.
%r and %T are 12 hour and 24 hour time formats respectively.
这篇关于mysql 12 hr到24 hr时间转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文