taith Posted February 13, 2007 Share Posted February 13, 2007 does anybody got a list of all the "date_timezone_set('x')" available? i specifically want eastern standard time... but the rest would be good to know too:-) Link to comment https://forums.phpfreaks.com/topic/38332-timezone-switch/ Share on other sites More sharing options...
Jessica Posted February 13, 2007 Share Posted February 13, 2007 http://us2.php.net/manual/en/function.timezone-identifiers-list.php http://us2.php.net/manual/en/function.timezone-abbreviations-list.php Link to comment https://forums.phpfreaks.com/topic/38332-timezone-switch/#findComment-183721 Share on other sites More sharing options...
taith Posted February 13, 2007 Author Share Posted February 13, 2007 i'm not sure if anybody else has built a function like this... but if you have, i'd be more then grateful... it'd be real nice to be able to switch timezones in reatltime efficiently... <?php function set_timezone($timezone="0"){ switch($timezone){ case "-12": break; case "-11": break; case "-10": break; case "-9": break; case "-8": break; case "-7": break; case "-6": break; case "-5": break; case "-4": break; case "-3": break; case "-2": break; case "-1": date_default_timezone_set('Atlantic/Azores'); break; case "0": date_default_timezone_set('Europe/London'); break; case "1": date_default_timezone_set('Europe/Paris'); break; case "2": date_default_timezone_set('Europe/Helsinki'); break; case "3": break; case "4": break; case "5": break; case "6": break; case "7": break; case "8": break; case "9": break; case "10": break; case "11": break; case "12": break; } } ?> Link to comment https://forums.phpfreaks.com/topic/38332-timezone-switch/#findComment-183773 Share on other sites More sharing options...
Jessica Posted February 13, 2007 Share Posted February 13, 2007 ted_chou12 made an array of all of them, look through his posts Link to comment https://forums.phpfreaks.com/topic/38332-timezone-switch/#findComment-183787 Share on other sites More sharing options...
taith Posted February 13, 2007 Author Share Posted February 13, 2007 yes... i found that... it was a list of the major towns in each timezone... but thats not the list of all the php settings i found most of em... still missing a few tho :-(... <?php function set_timezone($timezone="0"){ switch($timezone){ case "-12": date_default_timezone_set(''); break; case "-11": date_default_timezone_set('Pacific/Apia'); break; case "-10": date_default_timezone_set('Pacific/Honolulu'); break; case "-9": date_default_timezone_set('America/Anchorage'); break; case "-8": date_default_timezone_set('America/Los_Angeles'); break; case "-7": date_default_timezone_set('America/Denver'); break; case "-6": date_default_timezone_set('America/Chicago'); break; case "-5": date_default_timezone_set('America/New_York'); break; case "-4": date_default_timezone_set('America/Halifax'); break; case "-3": date_default_timezone_set('America/Sao_Paulo'); break; case "-2": date_default_timezone_set(''); break; case "-1": date_default_timezone_set('Atlantic/Azores'); break; case "0": date_default_timezone_set('Europe/London'); break; case "1": date_default_timezone_set('Europe/Paris'); break; case "2": date_default_timezone_set('Europe/Helsinki'); break; case "3": date_default_timezone_set('Europe/Moscow'); break; case "4": date_default_timezone_set('Asia/Dubai'); break; case "5": date_default_timezone_set('Asia/Karachi'); break; case "6": date_default_timezone_set(''); break; case "7": date_default_timezone_set('Asia/Krasnoyarsk'); break; case "8": date_default_timezone_set(''); break; case "9": date_default_timezone_set('Asia/Tokyo'); break; case "10": date_default_timezone_set('Australia/Melbourne'); break; case "11": date_default_timezone_set(''); break; case "12": date_default_timezone_set('Pacific/Auckland'); break; } } ?> Link to comment https://forums.phpfreaks.com/topic/38332-timezone-switch/#findComment-183815 Share on other sites More sharing options...
taith Posted February 13, 2007 Author Share Posted February 13, 2007 ohok... never mind... the ones not set dont have any major towns lol problem solved :-D that function is free whoever wants... Link to comment https://forums.phpfreaks.com/topic/38332-timezone-switch/#findComment-183830 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.