PHP timezone_name_from_abbr() Function
The PHP timezone_name_from_abbr() function returns the timezone name from abbreviation.
Syntax
timezone_name_from_abbr(abbr, utcOffset, isDST)
Parameters
abbr |
Required. Specify the timezone abbreviation. |
utcOffset |
Optional. Specify the offset from GMT in seconds. Defaults to -1 which means that first found time zone corresponding to abbr is returned. Otherwise exact offset is searched and only if not found then the first time zone with any offset is returned. |
isDST |
Optional. Specify the daylight saving time indicator. Default is -1. Possible values are:
|
Return Value
Returns time zone name on success or false on failure.
Example:
The example below shows the usage of timezone_name_from_abbr() function.
<?php //getting the time zone name for "PST" echo "1. ".timezone_name_from_abbr("PST")."\n"; //getting the time zone name for "EST" echo "2. ".timezone_name_from_abbr("EST")."\n"; //getting the time zone name for "CET" echo "3. ".timezone_name_from_abbr("CET")."\n"; //getting the time zone name using //utcOffset and isDST parameters echo "4. ".timezone_name_from_abbr("", 3600, 1)."\n"; echo "5. ".timezone_name_from_abbr("", 7200, 1)."\n"; ?>
The output of the above code will be:
1. America/Los_Angeles 2. America/New_York 3. Europe/Berlin 4. Europe/London 5. Europe/Paris
❮ PHP Date and Time Reference