使用PHP或MySQL将AM/PM时间转换为24小时格式? [英] Converting an AM/PM time to 24 hours format using PHP or MySQL?

查看:28
本文介绍了使用PHP或MySQL将AM/PM时间转换为24小时格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一段时间,例如:6:00 AM,7:30 PM等.它也可以轻松更改为6:00:00 AM,7:30:00 PM等.

I have a string of time such as: 6:00 AM, 7:30 PM, etc. It can easily be changed to 6:00:00 AM, 7:30:00 PM, etc as well.

我正在寻找一种方法来将此时间快速转换为24小时格式,例如7:30 PM = 19:30:00.

I'm looking for a way to quickly convert this time into a 24 hour format, e.g 7:30 PM = 19:30:00.

是否有具有此功能的PHP或MySQL函数,还是我必须自行设计?

Is there any PHP or MySQL function which has this capability, or do I have to devise my own?

推荐答案

STR_TO_DATE( `column_here`, '%l:%i %p' )

了解更多信息这里.

'%l:%M%p'编辑为'%l:%i%p'

这篇关于使用PHP或MySQL将AM/PM时间转换为24小时格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆