PHP,如何以某种格式获取当前日期
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5206829/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 20:38:01 来源:igfitidea点击:
PHP, How to get current date in certain format
提问by codereviewanskquestions
2011-03-04 21:00:40
2011-03-04 21:00:40
I want to get current date and time in the above format. How do I do this in PHP?
我想以上述格式获取当前日期和时间。我如何在 PHP 中做到这一点?
回答by Anomie
date('Y-m-d H:i:s')
. See the manualfor more.
date('Y-m-d H:i:s')
. 请参阅手册了解更多信息。
回答by u476945
date("Y-m-d H:i:s"); // This should do it.
回答by Patrick Beardmore
I belive the answer is:
我相信答案是:
echo date('Y-m-d H:i:s');