Curriculum
Course: PHP Basic
Login

Curriculum

PHP Basic

PHP Install

0/1

PHP Casting

0/1

PHP Constants

0/1

PHP Magic Constants

0/1

PHP Operators

0/1

PHP Reference

0/276
Text lesson

timezone_name_from_abbr()

Example

Retrieve the timezone name from a given abbreviation.

<?php
echo timezone_name_from_abbr(“EST”) . “<br>”;
echo timezone_name_from_abbr(“”,7200,0);
?>

Definition and Usage

The timezone_name_from_abbr() function returns the full timezone name based on the abbreviation.

Syntax

timezone_name_from_abbr(abbr, gmtoffset, isdst)

Parameter Values

 

Parameter

Description

abbr

Mandatory. Specifies the timezone abbreviation.

gmtoffset

Optional. Specifies the offset from GMT in seconds. By default, -1 is used, meaning the first timezone matching the abbreviation is returned. If a specific offset is provided, it searches for a timezone with that exact offset; if not found, the first timezone with any offset is returned.

isdst

Optional. Specifies the daylight saving time indicator:

  • -1 = Default. Daylight saving status is not considered when searching.
  • 1 = The gmtoffset includes daylight saving time.
  • 0 = The gmtoffset does not include daylight saving time.

Technical Details

Return Value:

Returns the timezone name on success or FALSE on failure.

PHP Version:

5.1.3+