【问题标题】:PHP: strtotime() gives me wrong timestampPHP:strtotime() 给了我错误的时间戳
【发布时间】:2010-12-03 08:05:16
【问题描述】:

这是我的代码:

$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

怎么了?

提前谢谢你。

【问题讨论】:

    标签: php timestamp strtotime


    【解决方案1】:

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

    t 是当月的天数,因此31

    【讨论】:

    • 哈哈,操作,我把它弄混了——真尴尬。谢谢!
    猜你喜欢
    • 2014-07-26
    • 2013-09-10
    • 1970-01-01
    • 2013-12-22
    • 1970-01-01
    • 1970-01-01
    • 2014-08-21
    • 2014-08-16
    • 1970-01-01
    相关资源
    最近更新 更多