Click here to Skip to main content
15,867,686 members
Articles / Programming Languages / PHP

Timezones in PHP

Rate me:
Please Sign up or sign in to vote.
3.84/5 (8 votes)
5 Aug 2008CPOL 36.6K   589   6   5
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)


Written By
Iran (Islamic Republic of) Iran (Islamic Republic of)
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionIndia / Kolkata missing Pin
Radhakrishna Bhandary24-Aug-16 20:40
Radhakrishna Bhandary24-Aug-16 20:40 
GeneralMy vote of 1 Pin
stankomix120-Dec-11 23:56
stankomix120-Dec-11 23:56 
Questiongreat Pin
headspring16-Sep-11 21:54
headspring16-Sep-11 21:54 
AnswerRe: great Pin
Mohammad Dayyan18-Sep-11 9:35
Mohammad Dayyan18-Sep-11 9:35 
Hi,
That's my pleasure. But please refer your post to this page.

Thanks
GeneralRe: great Pin
Zamshed Farhan11-Jan-13 5:49
Zamshed Farhan11-Jan-13 5:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.