基本问题在标题中:我有一个unix时间戳和一个时区,例如: “America/Caracas”,我想将其转换为当地时区。Perl:如何将unix时间戳+时区转换为本地时间
通过计算器搜索,我发现别人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' – Rahul
哎哟,我完全过度劳累!感谢那! woops! – Sarah