View Single Post
Old 01-30-2008, 05:17 PM   #2 (permalink)
Alan @ CIT
Member of the Month
The Frequenter
Member of the Month Top Contributor 
 
Alan @ CIT's Avatar
 
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
Alan @ CIT is on a distinguished road
Default

date_default_timezone_set() allows you to change the timezone for your script. For example:

PHP Code:
date_default_timezone_set('Europe/London');
echo 
date('H:i:s'time());
// shows: 17:13:40

date_default_timezone_set('Australia/Tasmania');
echo 
date('H:i:s'time());
// shows: 04:13:40 
As you can see, date() has given us different times depending on what timezone we have set.

You can provide this functionality by storing the users timezone choice (full list: PHP: List of Supported Timezones - Manual) then using date_default_timezone_set() before you run any date/time functions.

Also, PHP5 expects you to set a default timezone using date_default_timezone_set() before you use any date functions

Alan
Send a message via MSN to Alan @ CIT
Alan @ CIT is offline  
Reply With Quote