Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想使用 php 从他们的缩写中获取 gmt 中的时区偏移量。我已经搜索过它,但没有得到任何答案。
例如:- 我想使用 php 将 America/Los_Angeles 转换为 Gmt -7
可能吗 ?
您可以获得“-7”部分:
$dateTimeZone = new DateTimeZone("America/Los_Angeles"); $dateTimeZ = new DateTime("now", $dateTimeZone); $timeOffset = $dateTimeZone->getOffset($dateTimeZ)/3600;