PHP Classes
elePHPant
Icontem

PHP Timezone Names: Get the timezone name in full or abbreviated

Recommend this page to a friend!
  Info   View files Documentation   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2019-02-12 (2 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 59 This week: 18All time: 9,363 This week: 26Up
Version License PHP version Categories
time-zone-name 1.0Custom (specified...5PHP 5, Time and Date, Geography
Description Author

This class can get the timezone name in full or abbreviated and its offset.

It takes as parameters a string with the name of a timezone and a flag indicating if it is being considered the daylight savings.

The class can retrieve a list of known timezone names from a JSON configuration file and returns the given timezone full name, the abbreviated name and offset from UTC.

  Performance   Level  
Name: Peter Kahl <contact>
Classes: 37 packages by
Country: United Kingdom United Kingdom
Age: ???
All time rank: 53827 in United Kingdom United Kingdom
Week rank: 9 Up1 in United Kingdom United Kingdom Up
Innovation award
Innovation award
Nominee: 22x

Winner: 2x

Details

Time Zone Name

Downloads Download per Month License If this project has business value for you then don't hesitate to support me with a small donation.

Returns time zone name (e.g. 'Gulf Standard Time'), abbreviation (e.g. 'GST'), offset (decimal hours).

The reason for this library is that PHP DateTimeZone lacks (much of) this data.

Alternative time zone library available!

I have created an alternative library which is bit more complex, more versatile and uses SQL database. You may consider using it instead:

https://github.com/peterkahl/TimeZoneCity

Usage

use peterkahl\TimeZoneName\TimeZoneName;

$DateObj = new DateTime('now');
$DateObj->setTimeZone(new DateTimeZone('Asia/Dubai');

$namez = new TimeZoneName;

# Is DST in effect in the zone Asia/Dubai ?
$dst = $DateObj->format('I');

# Get abbreviation of timezone from zone db name and DST status:
echo $namez->GetAbbr('Asia/Dubai', $dst); # GST

# Get full name of timezone from zone db name and DST status:
echo $namez->GetName('Asia/Dubai', $dst); # Gulf Standard Time

# Get full name of timezone from zone db name and DST status:
echo $namez->GetOffset('Asia/Dubai', $dst); # 4

  Files folder image Files  
File Role Description
Files folder imagesrc (2 files)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
  Plain text file TimeZoneName.php Class Class source
  Accessible without login Plain text file timezones.json Data Auxiliary data

 Version Control Unique User Downloads Download Rankings  
 100%
Total:59
This week:18
All time:9,363
This week:26Up