开发者

php date misinterpretation

开发者 https://www.devze.com 2023-02-28 17:24 出处:网络
I run this: echo date(\'开发者_JAVA技巧l, F jS Y\',\'2011-02-12 14:44:00\'); I get this: Wednesday, December 31st 1969

I run this:

echo date('开发者_JAVA技巧l, F jS Y','2011-02-12 14:44:00');

I get this:

Wednesday, December 31st 1969

What's wrong?


The second argument for date needs to be a UNIX timestamp, not a date string. Use:

echo date('l, F jS Y', strtotime('2011-02-12 14:44:00'));

http://php.net/manual/en/function.date.php

0

精彩评论

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