Open In App

PHP | timezone_name_from_abbr() Function

The timezone_name_from_abbr() function is an inbuilt function in PHP which is used to return the timezone name from abbreviation. The abbreviation is sent as a parameter to the timezone_name_from_abbr() function and it returns the name of the timezone on success or False on failure.

Syntax:



string timezone_name_from_abbr( $abbr, $gmtoffset, $isdst )

Parameters: This function accepts three parameters as mentioned above and described below:

Return Value: It returns the name of the timezone on success or False on failure.



Exceptions: The timezone_name_from_abbr() function is an alias of DateTimeZone::listAbbreviations function.

Below program illustrate the timezone_name_from_abbr() function in PHP:

Program 1:




<?php
  
// Displaying the name of timezone using the abbreviation
$abbr = timezone_name_from_abbr("PST");
echo ("PST stands for " . $abbr);
?>

Output:
PST stands for America/Los_Angeles

Program 2:




<?php
  
// Displaying the name of timezone using the abbreviation
$abbr = timezone_name_from_abbr("", 7200, 0);
echo ("The given parameter stands for " . $abbr);
?>

Output:
The given parameter stands for Europe/Helsinki

Related Articles:

Reference: http://php.net/manual/en/function.timezone-name-from-abbr.php

Article Tags :