PHP:strtotime()给了我错误的时间戳

时间:2009-10-02 13:52:03

标签: php timestamp strtotime

这是我的代码:

$testtime = str_replace('.', '-', '2009.07.08 17:01');
$timestamp = strtotime($testtime);
echo $timestamp . "\n";
echo $testtime . "\n";
echo date('Y-m-d H:t', $timestamp);

这是我的输出:

  

1247065260

     

2009-07-08 17:01

     

2009-07-08 17:31

怎么了?

提前谢谢。

1 个答案:

答案 0 :(得分:8)

date()的参数错误。您应该使用date('Y-m-d H:i', $timestamp)

t是当月的天数,因此31

相关问题