且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

php strtotime不工作

更新时间:2022-11-13 14:44:26

正如@Evan Mulawski 的评论所说,2001"被解释为时间,而不是年份.去掉逗号让PHP将2001"解释为年份:

As @Evan Mulawski's comment says, the "2001" is being interpreted as the time, not the year. Take out the comma to get PHP to interpret the "2001" as a year:

<?php
$ts = strtotime("1 Nov 2001");
echo $ts . "
";
$st = strftime("%B %d, %Y, %H:%M:%S", $ts);
echo $st . "
";
?>

输出:

1004590800
2001 年 11 月 1 日 00:00:00

1004590800
November 01, 2001, 00:00:00