如何将整数时区转换为字符串时区
How to convert int timezone to string timezone
我想将此时区 10800 转换为字符串,如 php 中的“America/New York”。我试过 date_default_timezone_set 但它只适用于字符串。
如果您想要将时区偏移值表示为字符串,下面的 link 会有所帮助。
https://www.php.net/manual/en/function.timezone-name-from-abbr.php
https://www.php.net/manual/en/datetimezone.listabbreviations.php
<?php
$timezone_abbreviations = DateTimeZone::listAbbreviations();
echo "<pre>";
var_dump($timezone_abbreviations);
echo "</pre>";
?>
我想将此时区 10800 转换为字符串,如 php 中的“America/New York”。我试过 date_default_timezone_set 但它只适用于字符串。
如果您想要将时区偏移值表示为字符串,下面的 link 会有所帮助。
https://www.php.net/manual/en/function.timezone-name-from-abbr.php
https://www.php.net/manual/en/datetimezone.listabbreviations.php
<?php
$timezone_abbreviations = DateTimeZone::listAbbreviations();
echo "<pre>";
var_dump($timezone_abbreviations);
echo "</pre>";
?>