如何获取GMT日期在yyyy-mm-dd hh:mm:ss在PHP [英] How to get GMT date in yyyy-mm-dd hh:mm:ss in PHP
本文介绍了如何获取GMT日期在yyyy-mm-dd hh:mm:ss在PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试过:
gmdate('yyyy-mm-dd hh:mm:ss \G\M\T',time());
/ p>
它返回一个wierd日期:
13131313-1111-2323 0707:1111: 3131
解决方案
您不必重复这些格式标识符。对于 yyyy
,您只需要 Y
等。
gmdate('Ymd h:i:s \G\M\T',time());
其实你甚至不需要给它默认的时间,如果你想要当前时间
gmdate('Ymd h:i:s \G\M\T'); //这对你的目的很好
你可以得到这个列表的标识符 此处
I want to get the current date in yyyy-mm-dd hh:mm:ss format.
I have tried:
gmdate('yyyy-mm-dd hh:mm:ss \G\M\T', time());
Its returning a wierd date:
13131313-1111-2323 0707:1111:3131
解决方案
You don't have to repeat those format identifiers . For yyyy
you just need to have Y
, etc.
gmdate('Y-m-d h:i:s \G\M\T', time());
In fact you don't even need to give it a default time if you want current time
gmdate('Y-m-d h:i:s \G\M\T'); // This is fine for your purpose
You can get that list of identifiers Here
这篇关于如何获取GMT日期在yyyy-mm-dd hh:mm:ss在PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文