NOW() function in PHP

Is there a PHP function that returns the date & time in the same format as the MySQL function NOW() ?

I know how to do it using date() , but I am asking if there is a function only for this.

For example to return:

2009-12-01 00:00:00

除此之外:

date("Y-m-d H:i:s")

date('Y-m-d H:i:s')

在这里寻找更多的细节:http://pl.php.net/manual/en/function.date.php


With PHP version >= 5.4 DateTime can do this:-

echo (new DateTime())->format('Y-m-d H:i:s');

See it working.

链接地址: http://www.djcxy.com/p/75358.html

上一篇: 无法找到字符串中第一次出现的位置

下一篇: 在PHP中NOW()函数