Click here to Skip to main content
Click here to Skip to main content

Timezones in PHP

By , 5 Aug 2008
 

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
    date_default_timezone_set("Asia/Tehran"); //I set timezone for Tehran
?>

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

<?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)

About the Author

Mohammad Dayyan
Iran (Islamic Republic Of) Iran (Islamic Republic Of)
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralMy vote of 1memberstankomix120 Dec '11 - 23:56 
Questiongreatmemberheadspring16 Sep '11 - 21:54 
AnswerRe: greatmemberMohammad Dayyan18 Sep '11 - 9:35 
GeneralRe: greatmemberS.M. Zamshed Farhan11 Jan '13 - 5:49 

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

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130516.1 | Last Updated 5 Aug 2008
Article Copyright 2008 by Mohammad Dayyan
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid