English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP Date & Time Function Manual
The timezone_name_from_abbr() function returns the abbreviation form of the timezone name
Thetimezone_name_from_abbr()function to get the name of a timezone with an abbreviation.
timezone_name_from_abbr($abbr, [$gmtoffset[, $isdst]]);
Serial number | Parameters and descriptions |
---|---|
1 | abbr (required) This is a string value representing the abbreviation of the timezone you need to know the name of. |
2 | gmtOffset (optional) This is an integer value representing the offset from GMT (in seconds). If a value is provided, it will search for the timezone and return. If not found, it will return the first found timezone (based on the given abbreviation). |
3 | isdst (optional) This is an integer value that specifies the daylight saving time indicator for the timezone.
|
The PHP timezone_name_from_abbr() function returns a string value representing the timezone name. If it fails, this function returns a boolean valuefalse.
This function was originally introduced in PHP version5.2introduced in version 5.2.0 and is available in all higher versions.
The following examples demonstratetimezone_name_from_abbr()Usage of the function timezone_name_from_abbr() to return the timezone name based on the timezone abbreviation-
<?php $res = timezone_name_from_abbr("PST"); print($res); ?>Test and see‹/›
Output result
America/Los_Angeles
You can also get the timezone name by passing the offset value in the following format-
<?php //Set timezone $res = timezone_name_from_abbr("", 3600, 0); print($res); ?>Test and see‹/›
Output result
Europe/Paris
Returns the timezone name based on the timezone abbreviation
<?php echo timezone_name_from_abbr("CET")."\n"; echo timezone_name_from_abbr("", 3600, 0); ?>Test and see‹/›
Output result:
Europe/Berlin Europe/Paris