Home >>PHP Date Time Functions >PHP timezone_name_from_abbr() Function

PHP timezone_name_from_abbr() Function

PHP timezone_name_from_abbr() Function

PHP timezone_name_from_abbr() function is used to return the timezone name from the given abbreviation. The abbreviation is passed to it as a parameter. It returns the name of the timezone as output on success and False on failure.

Syntax:

timezone_name_from_abbr(abbr, gmtoffset, isdst);

Parameter Values

Parameter Description
abbr This is a required parameter. This parameter defines the timezone abbreviation.
gmtoffset This is an optional parameter. This parameter defines the offset from GMT in seconds.
isdst This is an optional parameter. This parameter defines the daylight saving time indicator.

Here is an example of timezone_name_from_abbr() function in PHP:

<html>
<body>
<?php
echo timezone_name_from_abbr("CDT")."<br>";
echo timezone_name_from_abbr("EWT")."<br>";
echo timezone_name_from_abbr("WET")."<br>";
?>
</body>
</html>
Output:
America/Chicago
America/New_York
Europe/Paris

Example 2:

<html>
<body>
<?php
echo timezone_name_from_abbr("",19800,0)."<br>";
echo timezone_name_from_abbr("",3600,0)."<br>";
echo timezone_name_from_abbr("",-28800,0)."<br>";
echo timezone_name_from_abbr("",-21600,0)."<br>";
?>
</body>
</html>
Output:
Asia/Kolkata
Europe/Paris
America/Los_Angeles
America/Chicago

No Sidebar ads