【问题标题】:PHP Unix to Date迄今为止的 PHP Unix
【发布时间】:2014-11-16 22:37:28
【问题描述】:

当我var_dump 一个特定的变量时,我得到:

'date' => int 1410307200

当我var_dumpdate('F j Y', strtotime($start_date)) 时,我得到:

string 'January 1 1970' (length=14)

当我不使用 strtotime 时,我得到相同的输出。

为什么一直返回epoch时间?

【问题讨论】:

  • 我会检查以确保$start_date 是您认为的那样。运行 echo date('F j Y', 1410307200); 给我一个预期的输出:“September 9 2014”

标签: php date strtotime epoch


【解决方案1】:

您在 Unix 时间戳上调用 strtotime()。这是多余的并且是错误的:

echo date('F j Y', $start_date)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-08-14
    • 2021-05-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-07
    相关资源
    最近更新 更多