PHP strftime 未显示正确的输出
我可能在这里做了一些非常愚蠢的事情,但这并没有给出预期的输出:
php > $time = "2011-05-05 20:15:29"; // Timestamp from MySQL database, in UTC.
php > date_default_timezone_set("America/New_York");
php > $ts = strtotime($time . " UTC");
php > strftime("%Y-%m-%d %H:%M:%S");
php > echo strftime("%Y-%m-%d %H:%M:%S");
2011-05-05 17:51:59
年、月和日是正确的,但所有内容(包括秒?)都关闭了。为什么?
I'm probably doing something really silly here, but this isn't giving the expected output:
php > $time = "2011-05-05 20:15:29"; // Timestamp from MySQL database, in UTC.
php > date_default_timezone_set("America/New_York");
php > $ts = strtotime($time . " UTC");
php > strftime("%Y-%m-%d %H:%M:%S");
php > echo strftime("%Y-%m-%d %H:%M:%S");
2011-05-05 17:51:59
Year, month and day are correct, but everything (including seconds?) is off. Why?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是因为您没有将争论 2 传递给
strftime
吗?Is this because you aren't passing arguement 2 to
strftime
?