Get the official American time zone in PHP?

后端 未结 2 1422
天命终不由人
天命终不由人 2020-12-07 06:38

I have account stored in my database and I have each account state on file, from there I want to link each account to a timezone based on the account state.

so if th

2条回答
  •  天命终不由人
    2020-12-07 06:58

    It's always best to go to the source: http://www.php.net/manual/en/timezones.america.php

    For all timezones: http://www.php.net/manual/en/timezones.php

    If you read down the page on the first link, someone was nice enough to make an array if you need the abbreviations:

    $aTimeZones = array(
      'America/Puerto_Rico'=>'AST',
      'America/New_York'=>'EDT',
      'America/Chicago'=>'CDT',
      'America/Boise'=>'MDT',
      'America/Phoenix'=>'MST',
      'America/Los_Angeles'=>'PDT',
      'America/Juneau'=>'AKDT',
      'Pacific/Honolulu'=>'HST',
      'Pacific/Guam'=>'ChST',
      'Pacific/Samoa'=>'SST',
      'Pacific/Wake'=>'WAKT',
    ); 
    

提交回复
热议问题