timezone_name_get


word apg

RETURNS one of the timezone list names.



<?php

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

    Object oriented style
   
   - - - - - - - - - - - - - - - - - */
   
str public str DateTimeZone::getName ( )


?>

<?php


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

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

str timezone_name_get DateTimeZone $object )


?>

$object


The DateTimeZone for which to get a name.





This function returns one of the timezone names in the list of timezones.



  1 EXERCISE   

<table align="center" width="100%" cellspacing="5" 
cellpadding="5" border="1">
<tr><td colspan="2">PREDEFINED CONSTANTS</td></tr>  
<tr><td width="80%">CONSTANT/MEANING</td> 
<td width="20%">VALUE</td></tr>
<?php

$arrtzg01 
= [DateTimeZone::AFRICA => 'DateTimeZone::AFRICA<br>Africa time zones',  
DateTimeZone::AMERICA => 'DateTimeZone::AMERICA<br>America time zones'
DateTimeZone::ANTARCTICA => 'DateTimeZone::ANTARCTICA<br>Antarctica time zones'
DateTimeZone::ARCTIC => 'DateTimeZone::ARCTIC<br>Arctic time zones'
DateTimeZone::ASIA => 'DateTimeZone::ASIA<br>Asia time zones'
DateTimeZone::ATLANTIC => 'DateTimeZone::ATLANTIC<br>Atlantic time zones'
DateTimeZone::AUSTRALIA => 'DateTimeZone::AUSTRALIA<br>Australia time zones'
DateTimeZone::EUROPE => 'DateTimeZone::EUROPE<br>Europe time zones'
DateTimeZone::INDIAN => 'DateTimeZone::INDIAN<br>Indian time zones'
DateTimeZone::PACIFIC => 'DateTimeZone::PACIFIC<br>Pacific time zones'
DateTimeZone::UTC => 'DateTimeZone::ALL<br>DateTimeZone::UTC UTC time zones'
DateTimeZone::ALL => 'DateTimeZone::ALL<br>All time zones'
DateTimeZone::ALL_WITH_BC => 'DateTimeZone::ALL_WITH_BC<br>All time zones including backwards compatible'
DateTimeZone::PER_COUNTRY => 'DateTimeZone::PER_COUNTRY<br>Time zones per country'];

foreach (
$arrtzg01 as $vcst01 => $v)
{
    echo 
'<tr><td>' $v '</td><td>' $vcst01 '</td></tr>';
}

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


 RESULT   

PREDEFINED CONSTANTS
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

  2 EXERCISE   

<?php

$tz02 
timezone_open("America/Los_Angeles");

$tz02 timezone_name_get($tz02);

echo 
$tz02;

?>


  3 EXERCISE   

<table align="center" width="100%" cellspacing="5" 
cellpadding="5" border="1"> 
<tr><td colspan="2">TimeZone Names</td></tr>   
<tr><td>ORD</td><td>TIMEZONE</td></tr>  
<?php

$tz03 
DateTimeZone::listIdentifiers(4095);
// $tz03 = DateTimeZone::listIdentifiers(DateTimeZone::ALL);   

foreach($tz03 as $z03 => $zn03)
{
    
    
$objtz03 = new DateTimeZone($zn03);
    
    
$tz03 timezone_name_get($objtz03);
    
    echo 
'<tr><td>' $z03 '</td><td>' $tz03 '</td></tr>';
    
}

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


  4 EXERCISE   

<?php

$tzOK04 
date_default_timezone_get(); 

echo 
$tzOK04 '<br>';

?>