timezone_identifiers_list


word apg

RETURNS a numerically indexed ARRAY containing all defined timezone identifiers.



<?php

/* - - - - - - - - - - - - - - - - -

    Object oriented style
   
   - - - - - - - - - - - - - - - - - */

arr public static DateTimeZone::listIdentifiers 
                       
int $timezoneGroup DateTimeZone::ALL 
               
str|null $countryCode null )

where,


$timezoneGroup One of DateTimeZone class constants
                             
(SEE the below TABLE)
              
$countryCode ISO 3166-1 compatible two-letters country code

?>

<?php

/* - - - - - - - - - - - - - - - - -

      Procedural style
   
   - - - - - - - - - - - - - - - - - */

arr timezone_identifiers_list 
                       
int $timezoneGroup DateTimeZone::ALL 
               
str|null $countryCode null )

where,


$timezoneGroup One of DateTimeZone class constants
                             
(SEE the below TABLE)
              
$countryCode ISO 3166-1 compatible two-letters country code

?>

 $timezoneGroup = DateTimeZone class constants 

ID MEANING
DateTimeZone::AFRICA Africa time zones
DateTimeZone::AMERICA America time zones
DateTimeZone::ANTARCTICA Antarctica time zones
DateTimeZone::ARCTIC Arctic time zones
DateTimeZone::ASIA Asia time zones
DateTimeZone::ATLANTIC Atlantic time zones
DateTimeZone::AUSTRALIA Australia time zones
DateTimeZone::EUROPE Europe time zones
DateTimeZone::INDIAN Indian time zones
DateTimeZone::PACIFIC Pacific time zones
DateTimeZone::ALL UTC time zones
DateTimeZone::ALL_WITH_BC All time zones
DateTimeZone::PER_COUNTRY All time zones including backwards compatible
Time zones per country
ed48


CONSTANT/MEANINGVALUE
DateTimeZone::AFRICA
Africa time zones
1
DateTimeZone::AMERICA
America time zones
2
DateTimeZone::ANTARCTICA
Antarctica time zones
4
DateTimeZone::ARCTIC
Arctic time zones
8
DateTimeZone::ASIA
Asia time zones
16
DateTimeZone::ATLANTIC
Atlantic time zones
32
DateTimeZone::AUSTRALIA
Australia time zones
64
DateTimeZone::EUROPE
Europe time zones
128
DateTimeZone::INDIAN
Indian time zones
256
DateTimeZone::PACIFIC
Pacific time zones
512
DateTimeZone::ALL
DateTimeZone::UTC UTC time zones
1024
DateTimeZone::ALL
All time zones
2047
DateTimeZone::ALL_WITH_BC
All time zones including backwards compatible
4095
DateTimeZone::PER_COUNTRY
Time zones per country
4096
ed48

 $countryCode 

VALUE MEANING
COUNTRY CODE TWO LETTERS, according: ISO 3166-1
Usado somente se:
$timezoneGroup = DateTimeZone::PER_COUNTRY
ed48


Timezone identifiers list
TIMEZONEISO 3166-1
COUNTRY
Africa/AbidjanCI
Africa/AccraGH
Africa/Addis_AbabaET
Africa/AlgiersDZ
Africa/AsmaraER
Africa/BamakoML
Africa/BanguiCF
Africa/BanjulGM
Africa/BissauGW
Africa/BlantyreMW
Africa/BrazzavilleCG
Africa/BujumburaBI
Africa/CairoEG
Africa/CasablancaMA
Africa/CeutaES
Africa/ConakryGN
Africa/DakarSN
Africa/Dar_es_SalaamTZ
Africa/DjiboutiDJ
Africa/DoualaCM
Africa/El_AaiunEH
Africa/FreetownSL
Africa/GaboroneBW
Africa/HarareZW
Africa/JohannesburgZA
Africa/JubaSS
Africa/KampalaUG
Africa/KhartoumSD
Africa/KigaliRW
Africa/KinshasaCD
Africa/LagosNG
Africa/LibrevilleGA
Africa/LomeTG
Africa/LuandaAO
Africa/LubumbashiCD
Africa/LusakaZM
Africa/MalaboGQ
Africa/MaputoMZ
Africa/MaseruLS
Africa/MbabaneSZ
Africa/MogadishuSO
Africa/MonroviaLR
Africa/NairobiKE
Africa/NdjamenaTD
Africa/NiameyNE
Africa/NouakchottMR
Africa/OuagadougouBF
Africa/Porto-NovoBJ
Africa/Sao_TomeST
Africa/TripoliLY
Africa/TunisTN
Africa/WindhoekNA
America/AdakUS
America/AnchorageUS
America/AnguillaAI
America/AntiguaAG
America/AraguainaBR
America/Argentina/Buenos_AiresAR
America/Argentina/CatamarcaAR
America/Argentina/CordobaAR
America/Argentina/JujuyAR
America/Argentina/La_RiojaAR
America/Argentina/MendozaAR
America/Argentina/Rio_GallegosAR
America/Argentina/SaltaAR
America/Argentina/San_JuanAR
America/Argentina/San_LuisAR
America/Argentina/TucumanAR
America/Argentina/UshuaiaAR
America/ArubaAW
America/AsuncionPY
America/AtikokanCA
America/BahiaBR
America/Bahia_BanderasMX
America/BarbadosBB
America/BelemBR
America/BelizeBZ
America/Blanc-SablonCA
America/Boa_VistaBR
America/BogotaCO
America/BoiseUS
America/Cambridge_BayCA
America/Campo_GrandeBR
America/CancunMX
America/CaracasVE
America/CayenneGF
America/CaymanKY
America/ChicagoUS
America/ChihuahuaMX
America/Costa_RicaCR
America/CrestonCA
America/CuiabaBR
America/CuracaoCW
America/DanmarkshavnGL
America/DawsonCA
America/Dawson_CreekCA
America/DenverUS
America/DetroitUS
America/DominicaDM
America/EdmontonCA
America/EirunepeBR
America/El_SalvadorSV
America/Fort_NelsonCA
America/FortalezaBR
America/Glace_BayCA
America/Goose_BayCA
America/Grand_TurkTC
America/GrenadaGD
America/GuadeloupeGP
America/GuatemalaGT
America/GuayaquilEC
America/GuyanaGY
America/HalifaxCA
America/HavanaCU
America/HermosilloMX
America/Indiana/IndianapolisUS
America/Indiana/KnoxUS
America/Indiana/MarengoUS
America/Indiana/PetersburgUS
America/Indiana/Tell_CityUS
America/Indiana/VevayUS
America/Indiana/VincennesUS
America/Indiana/WinamacUS
America/InuvikCA
America/IqaluitCA
America/JamaicaJM
America/JuneauUS
America/Kentucky/LouisvilleUS
America/Kentucky/MonticelloUS
America/KralendijkBQ
America/La_PazBO
America/LimaPE
America/Los_AngelesUS
America/Lower_PrincesSX
America/MaceioBR
America/ManaguaNI
America/ManausBR
America/MarigotMF
America/MartiniqueMQ
America/MatamorosMX
America/MazatlanMX
America/MenomineeUS
America/MeridaMX
America/MetlakatlaUS
America/Mexico_CityMX
America/MiquelonPM
America/MonctonCA
America/MonterreyMX
America/MontevideoUY
America/MontserratMS
America/NassauBS
America/New_YorkUS
America/NipigonCA
America/NomeUS
America/NoronhaBR
America/North_Dakota/BeulahUS
America/North_Dakota/CenterUS
America/North_Dakota/New_SalemUS
America/NuukGL
America/OjinagaMX
America/PanamaPA
America/PangnirtungCA
America/ParamariboSR
America/PhoenixUS
America/Port-au-PrinceHT
America/Port_of_SpainTT
America/Porto_VelhoBR
America/Puerto_RicoPR
America/Punta_ArenasCL
America/Rainy_RiverCA
America/Rankin_InletCA
America/RecifeBR
America/ReginaCA
America/ResoluteCA
America/Rio_BrancoBR
America/SantaremBR
America/SantiagoCL
America/Santo_DomingoDO
America/Sao_PauloBR
America/ScoresbysundGL
America/SitkaUS
America/St_BarthelemyBL
America/St_JohnsCA
America/St_KittsKN
America/St_LuciaLC
America/St_ThomasVI
America/St_VincentVC
America/Swift_CurrentCA
America/TegucigalpaHN
America/ThuleGL
America/Thunder_BayCA
America/TijuanaMX
America/TorontoCA
America/TortolaVG
America/VancouverCA
America/WhitehorseCA
America/WinnipegCA
America/YakutatUS
America/YellowknifeCA
Antarctica/CaseyAQ
Antarctica/DavisAQ
Antarctica/DumontDUrvilleAQ
Antarctica/MacquarieAU
Antarctica/MawsonAQ
Antarctica/McMurdoAQ
Antarctica/PalmerAQ
Antarctica/RotheraAQ
Antarctica/SyowaAQ
Antarctica/TrollAQ
Antarctica/VostokAQ
Arctic/LongyearbyenSJ
Asia/AdenYE
Asia/AlmatyKZ
Asia/AmmanJO
Asia/AnadyrRU
Asia/AqtauKZ
Asia/AqtobeKZ
Asia/AshgabatTM
Asia/AtyrauKZ
Asia/BaghdadIQ
Asia/BahrainBH
Asia/BakuAZ
Asia/BangkokTH
Asia/BarnaulRU
Asia/BeirutLB
Asia/BishkekKG
Asia/BruneiBN
Asia/ChitaRU
Asia/ChoibalsanMN
Asia/ColomboLK
Asia/DamascusSY
Asia/DhakaBD
Asia/DiliTL
Asia/DubaiAE
Asia/DushanbeTJ
Asia/FamagustaCY
Asia/GazaPS
Asia/HebronPS
Asia/Ho_Chi_MinhVN
Asia/Hong_KongHK
Asia/HovdMN
Asia/IrkutskRU
Asia/JakartaID
Asia/JayapuraID
Asia/JerusalemIL
Asia/KabulAF
Asia/KamchatkaRU
Asia/KarachiPK
Asia/KathmanduNP
Asia/KhandygaRU
Asia/KolkataIN
Asia/KrasnoyarskRU
Asia/Kuala_LumpurMY
Asia/KuchingMY
Asia/KuwaitKW
Asia/MacauMO
Asia/MagadanRU
Asia/MakassarID
Asia/ManilaPH
Asia/MuscatOM
Asia/NicosiaCY
Asia/NovokuznetskRU
Asia/NovosibirskRU
Asia/OmskRU
Asia/OralKZ
Asia/Phnom_PenhKH
Asia/PontianakID
Asia/PyongyangKP
Asia/QatarQA
Asia/QostanayKZ
Asia/QyzylordaKZ
Asia/RiyadhSA
Asia/SakhalinRU
Asia/SamarkandUZ
Asia/SeoulKR
Asia/ShanghaiCN
Asia/SingaporeSG
Asia/SrednekolymskRU
Asia/TaipeiTW
Asia/TashkentUZ
Asia/TbilisiGE
Asia/TehranIR
Asia/ThimphuBT
Asia/TokyoJP
Asia/TomskRU
Asia/UlaanbaatarMN
Asia/UrumqiCN
Asia/Ust-NeraRU
Asia/VientianeLA
Asia/VladivostokRU
Asia/YakutskRU
Asia/YangonMM
Asia/YekaterinburgRU
Asia/YerevanAM
Atlantic/AzoresPT
Atlantic/BermudaBM
Atlantic/CanaryES
Atlantic/Cape_VerdeCV
Atlantic/FaroeFO
Atlantic/MadeiraPT
Atlantic/ReykjavikIS
Atlantic/South_GeorgiaGS
Atlantic/St_HelenaSH
Atlantic/StanleyFK
Australia/AdelaideAU
Australia/BrisbaneAU
Australia/Broken_HillAU
Australia/DarwinAU
Australia/EuclaAU
Australia/HobartAU
Australia/LindemanAU
Australia/Lord_HoweAU
Australia/MelbourneAU
Australia/PerthAU
Australia/SydneyAU
Europe/AmsterdamNL
Europe/AndorraAD
Europe/AstrakhanRU
Europe/AthensGR
Europe/BelgradeRS
Europe/BerlinDE
Europe/BratislavaSK
Europe/BrusselsBE
Europe/BucharestRO
Europe/BudapestHU
Europe/BusingenDE
Europe/ChisinauMD
Europe/CopenhagenDK
Europe/DublinIE
Europe/GibraltarGI
Europe/GuernseyGG
Europe/HelsinkiFI
Europe/Isle_of_ManIM
Europe/IstanbulTR
Europe/JerseyJE
Europe/KaliningradRU
Europe/KievUA
Europe/KirovRU
Europe/LisbonPT
Europe/LjubljanaSI
Europe/LondonGB
Europe/LuxembourgLU
Europe/MadridES
Europe/MaltaMT
Europe/MariehamnAX
Europe/MinskBY
Europe/MonacoMC
Europe/MoscowRU
Europe/OsloNO
Europe/ParisFR
Europe/PodgoricaME
Europe/PragueCZ
Europe/RigaLV
Europe/RomeIT
Europe/SamaraRU
Europe/San_MarinoSM
Europe/SarajevoBA
Europe/SaratovRU
Europe/SimferopolUA
Europe/SkopjeMK
Europe/SofiaBG
Europe/StockholmSE
Europe/TallinnEE
Europe/TiraneAL
Europe/UlyanovskRU
Europe/UzhgorodUA
Europe/VaduzLI
Europe/VaticanVA
Europe/ViennaAT
Europe/VilniusLT
Europe/VolgogradRU
Europe/WarsawPL
Europe/ZagrebHR
Europe/ZaporozhyeUA
Europe/ZurichCH
Indian/AntananarivoMG
Indian/ChagosIO
Indian/ChristmasCX
Indian/CocosCC
Indian/ComoroKM
Indian/KerguelenTF
Indian/MaheSC
Indian/MaldivesMV
Indian/MauritiusMU
Indian/MayotteYT
Indian/ReunionRE
Pacific/ApiaWS
Pacific/AucklandNZ
Pacific/BougainvillePG
Pacific/ChathamNZ
Pacific/ChuukFM
Pacific/EasterCL
Pacific/EfateVU
Pacific/EnderburyKI
Pacific/FakaofoTK
Pacific/FijiFJ
Pacific/FunafutiTV
Pacific/GalapagosEC
Pacific/GambierPF
Pacific/GuadalcanalSB
Pacific/GuamGU
Pacific/HonoluluUS
Pacific/KiritimatiKI
Pacific/KosraeFM
Pacific/KwajaleinMH
Pacific/MajuroMH
Pacific/MarquesasPF
Pacific/MidwayUM
Pacific/NauruNR
Pacific/NiueNU
Pacific/NorfolkNF
Pacific/NoumeaNC
Pacific/Pago_PagoAS
Pacific/PalauPW
Pacific/PitcairnPN
Pacific/PohnpeiFM
Pacific/Port_MoresbyPG
Pacific/RarotongaCK
Pacific/SaipanMP
Pacific/TahitiPF
Pacific/TarawaKI
Pacific/TongatapuTO
Pacific/WakeUM
Pacific/WallisWF
UTC??
ed48




Prior to PHP 8.0.0 this function returns FALSE on failure.

Since PHP 7.1.0 the $contryCode must be nullable.



  1 EXERCISE   

<?php 
if (function_exists("timezone_identifiers_list")) 
{
echo 
"";
}
else
{
echo 
'FUNCTION NOT IMPLEMENTED ON THIS PLATFORM!';
exit;    
}
?>
<div class="circ bfff"><table width="100%" cellspacing="5" 
cellpadding="5" border="1" align="center">
<tbody><tr><td colspan="2">Timezone identifiers list</td><tr>
<td>ARRAY INDEX</td><td>TIMEZONE</td></tr>
<?php
$arr_timez_id_lst1 
timezone_identifiers_list();

foreach(
$arr_timez_id_lst1 as $t1 => $tz1)

echo 
'<tr><td>' $t1 '</td><td>' $tz1 '</td></tr>';


?>
<tr><td colspan="2">ed48</td></tr></tbody></table></div>


  2 EXERCISE   

<?php

// PROCEDURAL STYLE

$lang 'en';

$arr_timez_id_lst2 timezone_identifiers_list();

$en 'Timezone identifiers list: <br>';
echo $
$lang;

echo 
'<form id="form2" name="form2" method="post" action=""><select name="select">';

foreach( 
$arr_timez_id_lst2 as $timez2)
{
echo 
'<option value="' $timez2 '">' $timez2 '</option>';
}
echo 
'</select></form>';

?>

 

  3 EXERCISE   

<?php

// OBJECT ORIENTED STYLE

$lang 'en';

$arr_timez_id_lst3 DateTimeZone::listIdentifiers();

$en 'Timezone identifiers list: <br>';
echo $
$lang;

echo 
'<form id="form3" name="form3" method="post" action=""><select name="select">';

foreach( 
$arr_timez_id_lst3 as $timz3)
{
echo 
'<option value="' $timz3 '">' $timz3 '</option>';
}
echo 
'</select></form>';

// THE SAME RESULT AS THE PREVIOUS EXECISE

?> 

  4 EXERCISE   

<?php

// OBJECT ORIENTED STYLE 

$lang 'en';

$arr_timez_id_lst4 DateTimeZone::listIdentifiers(DateTimeZone::EUROPE);

$en 'EUROPE, Timezone identifiers list: <br>';
echo $
$lang;

echo 
'<form id="form4" name="form4" method="post" action=""><select name="select">';

foreach( 
$arr_timez_id_lst4 as $timz4)
{
echo 
'<option value="' $timz4 '">' $timz4 '</option>';
}
echo 
'</select></form><br>';

?> 

  5 EXERCISE   

<?php

// OBJECT ORIENTED STYLE  

$lang 'en';

$arr_timez_id_lst5 
DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY'PT');

$en 'PORTUGUESE LANGUAGE<br>Timezone identifiers list (PT): <br>';
echo $
$lang;

echo 
'<form id="form5" name="form5" method="post" action=""><select name="select">';

foreach( 
$arr_timez_id_lst5 as $timz5)
{
echo 
'<option value="' $timz5 '">' $timz5 '</option>';
}
echo 
'</select></form><br>';

?> 

  6 EXERCISE   

<?php

// OBJECT ORIENTED STYLE
// TIMEZONE EXISTENCE TEST 

$nt_tz06 = ['America/Sao_Paulo''America/New_York''America/Foo'];

$mt_rnd06 mt_rand(0,2);

// At each new run of this exercise, 
// a new result will be displayed.

$tz_ids06 DateTimeZone::listIdentifiers();

if (
in_array($nt_tz06[$mt_rnd06], $tz_ids06))

{
echo 
$nt_tz06[$mt_rnd06] . ' : EXIST';
}
else
{
echo 
$nt_tz06[$mt_rnd06] . ' : DOES NOT EXIST';
}

?> 

  7 EXERCISE   

<?php

// OBJECT ORIENTED STYLE

$lang 'en';  

$iso3166country 'AR';

$arr_timez_id_lst5 
DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY
                                                    
$iso3166country);

$en "Timezone identifiers list ($iso3166country): <br>";
echo $
$lang;

echo 
'<form id="form5" name="form5" method="post" action=""><select name="select">';

foreach( 
$arr_timez_id_lst5 as $timz5)
{
echo 
'<option value="' $timz5 '">' $timz5 '</option>';
}
echo 
'</select></form><br>';

?> 

  8 EXERCISE   

<style>
form {
border:solid 1px #999;
background:#CCC;
margin:10px;
padding:10px;
width:340px;
}
.cor { color:blue;  }
</style>
<?php
$tz_list 
timezone_identifiers_list();
?>

<form id="form2" name="form2" method="post" 
action="ctdwb.php" target="IFR">
<select name="tmz" size="1">

<?php
foreach ($tz_list as $tz_name)
{
?> 
<option value="<?php echo $tz_name?>">
<?php echo $tz_name?></option>
<?php
}
?>
</select>
<input type="submit" name="Submit" value="SEE">
</form><br>

<span class="cor"><iframe name="IFR" 
id="IFR" style="border:none; color:#0000ff; 
top:100px; width:400px; height:120px;"></iframe></span>


<!-- COMPLEMENT OF THE PREVIOUS EXERCISE -->

<!-- ctdwb.php -->

<style>
html { font-style:italic; color:blue; }
</style>
<?php
if(!isset($_POST['tmz']))
{
$tz 'America/Sao_Paulo';
}
else
{
$tz $_POST['tmz'];
}
date_default_timezone_set($tz);
$br_loctm localtime(time(), true);
$font 'Arial.ttf';

$smb_sp ' ';
$smb_abre '( ';
$smb_fecha ' )';
$smb_sep '/';
$smb_nwl '<br>';
$smb_h 'h';
$smb_min 'min';
$smb_s 's';

$msg_transc 'Days elapsed this year: ';
$msg_dias_ano  ' day of the year!';
$msg_dias ' days ';
$msg_dia ' day ';

$dia $br_loctm['tm_mday'];
$mes bcadd($br_loctm['tm_mon'], 1);
$ano bcadd($br_loctm['tm_year'], 1900);
$anoqvem bcadd($ano1);
$h $br_loctm['tm_hour'];
$min $br_loctm['tm_min'];
$s $br_loctm['tm_sec'];
$nrdia bcadd($br_loctm['tm_yday'], 1);
$horaatual $h $smb_h $min $smb_min $s $smb_s;

if( 
bcmod($ano4) == || bcmod($ano400) == 0)
{
$totaldias 367;
$w 368;
}
else
{
$totaldias 366;
$w 367;
}
$final =  bcsub($totaldias$nrdia);
$datahoje 'Date: ' $dia $smb_sep $mes $smb_sep $ano;
$numerodia $nrdia $msg_dias_ano;

if (
$final == 1)
{
$msg_transc 'Days elapsed this local year: ' $nrdia '<br>';
$msg_faltam 'Missing: ';
$qtofalta $final $msg_dia ' left until the year '$anoqvem;
echo 
$datahoje ' ';
echo 
$horaatual $h $smb_h $min $smb_min $s $smb_s '<br>'
echo 
$msg_faltam  $qtofalta '<br>';
echo 
$msg_transc;
echo 
'<br>Timezone: ' .$tz;
}
else
{
$msg_transc 'Days elapsed this local year: ' $nrdia '<br>';
$msg_faltam 'Missing: ';
$qtofalta $final $msg_dias ' left until the year ' $anoqvem;
echo 
$datahoje ' ';
echo 
$horaatual $h $smb_h $min $smb_min $s $smb_s '<br>'
echo 
$msg_faltam  $qtofalta '<br>';
echo 
$msg_transc;
echo 
'<br>Timezone: ' .$tz;
}

?>



 Obsolete Timezone Identifiers 


Brazil/Acre, Brazil/DeNoronha, Brazil/East, Brazil/West, Canada/Atlantic, Canada/Central, Canada/East-Saskatchewan, Canada/Eastern, Canada/Mountain, Canada/Newfoundland, Canada/Pacific, Canada/Saskatchewan, Canada/Yukon, CET, Chile/Continental, Chile/EasterIsland, CST6CDT, Cuba, EET, Egypt, Eire, EST, EST5EDT, Etc/GMT, Etc/GMT+0, Etc/GMT+1, Etc/GMT+10, Etc/GMT+11, Etc/GMT+12, Etc/GMT+2, Etc/GMT+3, Etc/GMT+4, Etc/GMT+5, Etc/GMT+6, Etc/GMT+7, Etc/GMT+8, Etc/GMT+9, Etc/GMT-0, Etc/GMT-1, Etc/GMT-10, Etc/GMT-11, Etc/GMT-12, Etc/GMT-13, Etc/GMT-14, Etc/GMT-2, Etc/GMT-3, Etc/GMT-4, Etc/GMT-5, Etc/GMT-6, Etc/GMT-7, Etc/GMT-8, Etc/GMT-9, Etc/GMT0, Etc/Greenwich, Etc/UCT, Etc/Universal, Etc/UTC, Etc/Zulu, Factory, GB, GB-Eire, GMT, GMT+0, GMT-0, GMT0, Greenwich, Hongkong, HST, Iceland, Iran, Israel, Jamaica, Japan, Kwajalein, Libya, MET, Mexico/BajaNorte, Mexico/BajaSur, Mexico/General, MST, MST7MDT, Navajo, NZ, NZ-CHAT, Poland, Portugal, PRC, PScr8PDT, ROC, ROK, Singapore, Turkey, UCT, Universal, US/Alaska, US/Aleutian, US/Arizona, US/Central, US/East-Indiana, US/Eastern, US/Hawaii, US/Indiana-Starke, US/Michigan, US/Mountain, US/Pacific, US/Pacific-New, US/Samoa, W-SU, WET, Zulu.