timezone_abbreviations_list


word apg

RETURNS an associative ARRAY containing DST offset and timezone name.



<?php

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

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

arr public static array DateTimeZone::listAbbreviations ( )


?>

<?php

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

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

arr timezone_abbreviations_list ( )


?>



This function is able to return the timezone abbreviations.



  1 EXERCISE   

<?php

$lang 
'en';

if (
function_exists("timezone_abbreviations_list"))
{
$arr_timez_abb_lst1 timezone_abbreviations_list();

$nb01 count($arr_timez_abb_lst1);

$en 'Timezone abbreviations list: <br>';
echo $
$lang;
echo 
'<pre>';
var_dump($arr_timez_abb_lst1);
echo 
'</pre><br>';

}
else
{
$en 'FUNCTION NOT IMPLEMENTED ON THIS PLATFORM!';
echo $
$lang '<br>';
}

?>


  2 EXERCISE   

<?php

echo 'PHP: ' PHP_VERSION '<br><br>';

$arr_abbr_lst timezone_abbreviations_list();
$arr_keys_lst array_keys($arr_abbr_lst);

foreach(
$arr_keys_lst as $abrv)
{
echo 
'"' $abrv '", ';
}

?>

  3 EXERCISE   

<?php

$arr_abbr_list 
DateTimeZone::listAbbreviations();
?>

<table align="center" width="100%" cellspacing="5" 
cellpadding="5" border="1">
<tr><td>Timezone ID<br><?php echo 'PHP ' PHP_VERSION?></td><td>ABBREVIATIONS</td><td>offset</td>
<td>GMT DIFFERENCE</td></tr>
<?php

    $arr_abbr_lst 
timezone_abbreviations_list();
    
$abr array_keys($arr_abbr_lst);
    
foreach(
$abr as $x)
{
foreach(
$arr_abbr_list[$x] as $tzname)
{

echo 
'<tr>
      <td>' 
$tzname['timezone_id'] . '</td><td>' $x
       
'</td><td>' $tzname['offset']
        . 
'</td><td>' bcdiv($tzname['offset'], 3600) . 'h</td></tr>';
}
}

?>
<tr><td colspan="4">ed48</td></tr></table>


  4 EXERCISE   

<?php

$arr_abbr_list 
DateTimeZone::listAbbreviations();

?>
<table align="center" width="100%" cellspacing="5" 
cellpadding="5" border="1"><tr>
<td>Timezone ID</td><td>ABBR</td><td>NAME</td>
<td>offset</td><td>GMT DIFFERENCE</td></tr>
<?php

$abr 
= [ "ywt" => "Yukon Time Zone""ypt" => "YPT"
"ydt" => "YDT",  "yddt" => "YDDT",  "wmt" => "WMT",  
"wit" => "WIT",  "wita" => "WITA",  "wib" => "WIB",  
"wet" => "Western European Time",  
"west" => "Western European Summer Time",  "wemt" => "WEMT",  
"wat" => "West Africa Time",  "wast" => "West Africa Summer Time",  
"utc" => "Coordinated Universal Time",  "uct" => "UCT",  
"tmt" => "Turkmenistan Time",  "tbmt" => "TBMT",  
"sst" => "Singapore Standard Time",  "smt" => "SMT",  
"sjmt" => "SJMT",  "sdmt" => "SDMT",  
"sast" => "South African Standard Time",  "rmt" => "RMT",  
"qmt" => "QMT",  "pwt" => "PWT",  "pst" => "Philippine Standard Time",  
"ppt" => "PPT",  "ppmt" => "PPMT",  "pmt" => "PMT",  
"plmt" => "PLMT",  "pkt" => "Pakistan Standard Time",  
"pkst" => "PKST",  "pdt" => "Pacific Daylight Time",  
"pddt" => "PDDT",  "nzst" => "New Zealand Standard Time",  
"nzmt" => "NZMT",  "nzdt" => "New Zealand Daylight Time",  
"nwt" => "NWT",  "nst" => "Newfoundland Standard Time",  
"npt" => "Nepal Time",  "ndt" => "Newfoundland Daylight Time",  
"nddt" => "NDDT",  "mwt" => "MWT",  "mst" => "Mountain Standard Time",  
"msk" => "Moscow Time",  "msd" => "MSD",  "mpt" => "MPT",  
"mmt" => "Myanmar Standard Time",  "mdt" => "Mountain Daylight Time",  
"mdst" => "MDST",  "mddt" => "MDDT",  "lst" => "LST",  
"kst" => "Korea Standard Time",  "kmt" => "KMT",  "kdt" => "KDT",  
"jst" => "Japan Standard Time",  "jmt" => "JMT",  "jdt" => "JDT",  
"ist" => "Israel Standard Time",  "imt" => "IMT",  
"idt" => "Israel Daylight Time",  "iddt" => "IDDT",  
"hst" => "Hawaii–Aleutian Standard Time",  
"hmt" => "Heard and McDonald Islands Time",  "hkt" => "Hong Kong Time",  
"hkst" => "HKST",  "hdt" => "Hawaii–Aleutian Daylight Time",  
"gst" => "Gulf Standard Time",  "gmt" => " Greenwich Mean Time",  
"fmt" => "FMT",  "ffmt" => "FFMT",  "ewt" => "EWT",  
"est" => "Eastern Standard Time",  "ept" => "EPT",  "emt" => "EMT",  
"eet" => "Eastern European Time",  "eest" => "Eastern European Summer Time",  
"edt" => "Eastern Daylight Time",  "eddt" => "EDDT",  
"eat" => "East Africa Time",  "dmt" => "DMT",  
"chst" => "Chamorro Standard Time",  "cwt" => "CWT",  
"cst" => "Cuba Standard Time",  "cpt" => "CPT",  "cmt" => "CMT",  
"cet" => "Central European Time",  "cest" => "Central European Summer Time",  
"cemt" => "CEMT",  "cdt" => "Cuba Daylight Time",  "cddt" => "CDDT",  
"cat" => "Central Africa Time",  "cast" => "CAST",  
"bst" => "British Summer Time",  "bmt" => "BMT",  
"bdt" => "Brunei Time",  "bdst" => "BDST",  "awt" => "AWT",  
"awst" => "Australian Western Standard Time",  "awdt" => "AWDT",  
"ast" => "Atlantic Standard Time",  "apt" => "APT",  
"amt" => "Armenia Time",  "akst" => "Alaska Standard Time",  
"akdt" => "Alaska Daylight Time",  "ahst" => "AHST",  
"ahdt" => "AHDT",  "aest" => "Australian Eastern Standard Time",  
"aedt" => "Australian Eastern Daylight Savings Time",  
"adt" => "Atlantic Daylight Time",  "addt" => "ADDT",  
"acst" => "Australian Central Standard Time"
"acdt" => "Australian Central Daylight Savings Time" ];

$cnt count($abr);
$cnt $cnt 1;

foreach(
$abr as $x => $v)
{
foreach(
$arr_abbr_list[$x] as $tzname)
{
{
echo 
'    <tr>
      <td>' 
$tzname['timezone_id']
      . 
'</td><td>' $x
       
'</td><td>' $v '</td><td>' $tzname['offset']
        . 
'</td><td>' bcdiv($tzname['offset'], 3600) . 'h</td></tr>';
}
}
}

?>
<tr><td colspan="5">ed48</td></tr></table>