PHP将PM和AM转换为24小时 [英] PHP turn PM and AM into 24 hour

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

问题描述

所以我需要离开PHP到pm / am到24小时的时间,我们使用Yahoo API来获取汇率,但是他们似乎是在am / pm给我们。

So I need away to in PHP turn pm / am into 24 hour time, We use Yahoo API to get currency rates, but they seem to give it to us by am/pm.

我以为日期可能正常,但是当我阅读这个功能时,将无法将pm转换成24小时。

I thought date might work, but when I read into that function it would had no way to turning pm into 24 hours.

5: 55pm


推荐答案

date("H:i", strtotime("5:55 pm"));

如果你想要另一种方式,

and if you want to go the other way,

date("g:i a", strtotime("17:55"));

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

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