基本問題在標題中:我有一個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