【发布时间】:2011-07-15 14:08:45
【问题描述】:
基本问题在标题中:我有一个 unix 时间戳和一个时区,例如“America/Caracas”,我想将其转换为时区的当地时间。
通过stackoverflow搜索,我找到了其他人asking pretty much the same question,但是,提供的答案代码
$t = new DateTime();
$t->setTimestamp( $time=time() );
$t->setTimeZone(new DateTimeZone("America/Denver"));
print $t->format(DateTime::RFC850);
不起作用(不再起作用?)。 DateTime() 不允许我设置时间戳;我确实查看了 DateTime 源,但也没有看到我可以在哪里连接我自己的时间戳。有什么想法/帮助吗?
非常感谢!
【问题讨论】:
-
那个帖子指的是
DateTime in PHP而不是perl -
哎呀,我完全过度劳累了!感谢那!哎呀!
标签: perl date time timezone localtime