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
2018-03-20 (7 months ago) RSS 2.0 feedStarStarStar 40%Total: 109 All time: 8,959 This week: 423Up
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: 36 packages by
Country: United Kingdom United Kingdom
Age: ???
All time rank: 56327 in United Kingdom United Kingdom
Week rank: 16 Up1 in United Kingdom United Kingdom Up
Innovation award
Innovation award
Nominee: 21x

Winner: 1x


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,959
This week:423Up
 User Ratings  
 All time