Hi all, I have inherited a php script that I am hosting on a US server but am trying to get it to work using Australian timezones (its a booking script). BEfore you ask, changing the timezone of the server is unfortunately not an option. I have narrowed the problem code down to the below, adding date_default_timezone_set('Australia/ACT'); PHP: gets the display part working but when they submit times for booking based on the $dtDate PHP: variable, it is submitted based on server time. Any ideas? <? session_start(); date_default_timezone_set('Australia/ACT'); require 'common.php'; $dtDate = date("Y-m-d", mktime(0, 0, 0, date("m") , date("d")+$_SESSION[OFFSET], date("Y"))); ?> PHP:
setTimeZone("2"); function setTimeZone($GMT) { $timezones = array( '-12'=>'Pacific/Kwajalein', '-11'=>'Pacific/Samoa', '-10'=>'Pacific/Honolulu', '-9'=>'America/Juneau', '-8'=>'America/Los_Angeles', '-7'=>'America/Denver', '-6'=>'America/Mexico_City', '-5'=>'America/New_York', '-4'=>'America/Caracas', '-3.5'=>'America/St_Johns', '-3'=>'America/Argentina/Buenos_Aires', '-2'=>'Atlantic/Azores',// no cities here so just picking an hour ahead '-1'=>'Atlantic/Azores', '0'=>'Europe/London', '1'=>'Europe/Paris', '2'=>'Europe/Helsinki', '3'=>'Europe/Moscow', '3.5'=>'Asia/Tehran', '4'=>'Asia/Baku', '4.5'=>'Asia/Kabul', '5'=>'Asia/Karachi', '5.5'=>'Asia/Calcutta', '6'=>'Asia/Colombo', '7'=>'Asia/Bangkok', '8'=>'Asia/Singapore', '9'=>'Asia/Tokyo', '9.5'=>'Australia/Darwin', '10'=>'Pacific/Guam', '11'=>'Asia/Magadan', '12'=>'Asia/Kamchatka' ); //date_default_timezone_set($timezones[$GMT]); custom_timezone_set($timezones[$GMT]); return true; } function custom_timezone_set( $tz ) { if (function_exists('date_default_timezone_set')) { date_default_timezone_set( $tz ); } else { putenv("TZ=$tz"); } } function custom_timezone_get() { if (function_exists('date_default_timezone_get')) { date_default_timezone_get(); } else { getenv("TZ"); } }