PHP: How to get timezone value (ex: Eastern Standard Time) from timezone name (ex: America/New_York)?

前端 未结 2 1946
独厮守ぢ
独厮守ぢ 2021-01-23 04:51

Is there a PHP function anywhere which converts between the timezone name (such as those found here: http://php.net/manual/en/timezones.america.php) and the \"value\" such as Ea

2条回答
  •  不思量自难忘°
    2021-01-23 05:24

    If you know the value from your list at (http://php.net/manual/en/timezones.america.php) you can do something like.

    setTimeZone(new DateTimeZone('America/New_York'));
    echo $dateTime->format('T'); 
    
    ?>
    

提交回复
热议问题