开发者

How to get the current time in the format `2010-12-20 06:32:48` with PHP?

开发者 https://www.devze.com 2023-01-31 23:25 出处:网络
Anyone knows how to do it? What 开发者_JS百科I know is time() but it\'s pure digits..As you\'ve said, you can get the current timestamp via the time function. You can then pass this timestamp to PHP\

Anyone knows how to do it?

What 开发者_JS百科I know is time() but it's pure digits..


As you've said, you can get the current timestamp via the time function. You can then pass this timestamp to PHP's date function. (It'll use the current time if no timestamp is provided.)

The specific format you're after is:

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


To obtain a formatted date/timestamp use the date() function

$dt = date('Y-m-d H:i:s');
0

精彩评论

暂无评论...
验证码 换一张
取 消