PHP Classes

PHP TimeZones: Retrieve or validate world time zones

Recommend this page to a friend!
  Info   View files Documentation   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2017-08-03 (4 months ago) RSS 2.0 feedNot enough user ratingsTotal: 102 All time: 8,809 This week: 609Up
Version License PHP version Categories
timezones 0.1Custom (specified...5PHP 5, Time and Date, Geography
Description Author

This is a simple class that can retrieve or validate world time zones.

It can return associative array with the list of all timezones by name and the time offsets relative to UTC.

The class can also validate if a given timezone name is known.

Innovation Award
PHP Programming Innovation award nominee
March 2017
Number 10
The world is divided into regions with different time zones, each with one time difference relative to the UTC time.

This class has the information of all the different time zones. It can validate time zones by name, as well return the time zones and the respective time offset.

Manuel Lemos
  Performance   Level  
Name: Peter Kahl <contact>
Classes: 32 packages by
Country: Hong Kong Hong Kong
Age: ???
All time rank: 6584 in Hong Kong Hong Kong
Week rank: 27 Up1 in Hong Kong Hong Kong Up
Innovation award
Innovation award
Nominee: 19x


Time Zones

Array of world time zones, sorted by time offset and alphabetically.


Please consider using the newer, better!


Generate HTML code for SELECT tag:

use peterkahl\timeZones\timeZones;

echo '<select>';
$zones = timeZones::getZones();
foreach ($zones as $code => $descr) {
  echo '<option value="'. $code .'">'. $descr .'</option>';
echo '</select>';

Get city name of given time zone:

use peterkahl\timeZones\timeZones;

$info = timeZones::getInfo('Africa/Sao_Tome');
$arr  = explode(') ', info)
$city = end($arr); # São Tomé and Príncipe

# Remove accents
$city = timeZones::RemoveAccents($city); # Sao Tome and Principe

  Files folder image Files  
File Role Description
Files folder imagesrc (1 file)
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 Doc. Documentation

  Files folder image Files  /  src  
File Role Description
  Plain text file timeZones.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:8,809
This week:609Up