Jump to content

timezone switch


taith

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.