我在格式中有一个简单的日期时间10/20 4:30PM.我希望它以格式显示
10/24 1:30PM -007.我说date('Y-m-d H:i:sT', $time_recieved)假设T是为了时区.但它还没有给出时区.可能是什么原因?我还缺少其他任何格式吗?
你可以看看PHP的官方手册:date();
http://www.php.net/manual/en/function.date.php
我对此进行了测试,并在我的服务器上使用了:
$time = time();
echo date('Y-m-d H:i:s T', $time);
Run Code Online (Sandbox Code Playgroud)
它完美地显示了时区。检查 $time_received,它可能是一个错误的数字,尝试使用 time´() 函数使用本地时间以确保它没问题。
祝你好运