Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / PHP

Timezones in PHP

3.84/5 (8 votes)
5 Aug 2008CPOL 1   591  
List of all timezones in PHP.

TimeZoneList.jpg

Introduction

In PHP 5, there are some methods to set or get the default timezone. For example, using this code, I set the default timezone used by all date/time functions:

PHP
<?php
    date_default_timezone_set("Asia/Tehran"); //I set timezone for Tehran
?>

In another example, I set the default timezone for Tokyo:

PHP
<?php
    date_default_timezone_set("Asia/Tokyo");
?>

There are many lists of timezones in the PHP manual (for more info about date_default_timezone_set, see here). I just got them into the menu list in HTML.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)