PHP timezone_name_from_abbr() Function
Definition
The timezone_name_from_abbr() returns the timezone name from abbreviation.
Syntax
PHP timezone_name_from_abbr() Function has the following syntax.
timezone_name_from_abbr(abbr,gmtoffset,isdst);
Parameter
Parameter | Is Required | Description |
---|---|---|
abbr | Required. | timezone abbreviation |
gmtoffset | Optional. | 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. | Specifies daylight saving time indicator. |
isdst values to use
- -1 - Defaults to -1, whether the time zone has daylight saving or not is not taken into consideration when searching.
- 1 - the gmtOffset is assumed to be an offset with daylight saving in effect;
- 0 - gmtOffset is assumed to be an offset without daylight saving in effect. If abbr doesn't exist then the time zone is searched solely by the gmtOffset and isdst.
Return
PHP timezone_name_from_abbr() Function returns the timezone name on success. FALSE on failure.
Example
Return the timezone name from abbreviation:
<?php
echo timezone_name_from_abbr("EST") . "\n";
echo timezone_name_from_abbr("",7200,0);
?>
The code above generates the following result.