Obviously, it's a good idea to return a user's timezone in an api by the word: "tijuana" or "Sri Jayawardenepura". You can work with that, it's perfectly normalised.
at least, that's what twitter thinks.
If you need an integer as representation of the users timezone on twitter, here is a function for you:
public function getOffsetFromTwitterTimezone($timezone) {
$aTimezones = array(
"Hawaii" => -1000,
"Alaska" => -900,
"Pacific Time (US & Canada)" => -800,
"Arizona" => -700,
"Mountain Time (US & Canada)" => -700,
"Central Time (US & Canada)" => -600,
"Eastern Time (US & Canada)" => -500,
"Indiana (East)" => -500,
"International Date Line West" => -1100,
"Midway Island" => -1100,
"Samoa" => -1100,
"Tijuana" => -800,
"Chihuahua" => -700,
"Mazatlan" => -700,
"Central America" => -600,
"Guadalajara" => -600,
"Mexico City" => -600,
"Monterrey" => -600,
"Saskatchewan" => -600,
"Bogota" => -500,
"Lima" => -500,
"Quito" => -500,
"Caracas" => -450,
"Atlantic Time (Canada)" => -400,
"La Paz" => -400,
"Santiago" => -400,
"Newfoundland" => -350,
"Brasilia" => -300,
"Buenos Aires" => -300,
"Georgetown" => -300,
"Greenland" => -300,
"Mid-Atlantic" => -200,
"Azores" => -100,
"Cape Verde Is." => -100,
"Casablanca" => 0,
"Dublin" => 0,
"Edinburgh" => 0,
"Lisbon" => 0,
"London" => 0,
"Monrovia" => 0,
"Amsterdam" => 100,
"Belgrade" => 100,
"Berlin" => 100,
"Bern" => 100,
"Bratislava" => 100,
"Brussels" => 100,
"Budapest" => 100,
"Copenhagen" => 100,
"Ljubljana" => 100,
"Madrid" => 100,
"Paris" => 100,
"Prague" => 100,
"Rome" => 100,
"Sarajevo" => 100,
"Skopje" => 100,
"Stockholm" => 100,
"Vienna" => 100,
"Warsaw" => 100,
"West Central Africa" => 100,
"Zagreb" => 100,
"Athens" => 200,
"Bucharest" => 200,
"Cairo" => 200,
"Harare" => 200,
"Helsinki" => 200,
"Istanbul" => 200,
"Jerusalem" => 200,
"Kyiv" => 200,
"Minsk" => 200,
"Pretoria" => 200,
"Riga" => 200,
"Sofia" => 200,
"Tallinn" => 200,
"Vilnius" => 200,
"Baghdad" => 300,
"Kuwait" => 300,
"Moscow" => 300,
"Nairobi" => 300,
"Riyadh" => 300,
"St. Petersburg" => 300,
"Volgograd" => 300,
"Tehran" => 350,
"Abu Dhabi" => 400,
"Baku" => 400,
"Muscat" => 400,
"Tbilisi" => 400,
"Yerevan" => 400,
"Kabul" => 450,
"Ekaterinburg" => 500,
"Islamabad" => 500,
"Karachi" => 500,
"Tashkent" => 500,
"Chennai" => 550,
"Kolkata" => 550,
"Mumbai" => 550,
"New Delhi" => 550,
"Kathmandu" => 575,
"Almaty" => 600,
"Astana" => 600,
"Dhaka" => 600,
"Novosibirsk" => 600,
"Sri Jayawardenepura" => 600,
"Rangoon" => 650,
"Bangkok" => 700,
"Hanoi" => 700,
"Jakarta" => 700,
"Krasnoyarsk" => 700,
"Beijing" => 800,
"Chongqing" => 800,
"Hong Kong" => 800,
"Irkutsk" => 800,
"Kuala Lumpur" => 800,
"Perth" => 800,
"Singapore" => 800,
"Taipei" => 800,
"Ulaan Bataar" => 800,
"Urumqi" => 800,
"Osaka" => 900,
"Sapporo" => 900,
"Seoul" => 900,
"Tokyo" => 900,
"Yakutsk" => 900,
"Adelaide" => 950,
"Darwin" => 950,
"Brisbane" => 1000,
"Canberra" => 1000,
"Guam" => 1000,
"Hobart" => 1000,
"Melbourne" => 1000,
"Port Moresby" => 1000,
"Sydney" => 1000,
"Vladivostok" => 1000,
"Magadan" => 1100,
"New Caledonia" => 1100,
"Solomon Is." => 1100,
"Auckland" => 1200,
"Fiji" => 1200,
"Kamchatka" => 1200,
"Marshall Is." => 1200,
"Wellington" => 1200,
"Nuku'alofa" =>1300);
return $aTimezones[$timezone];
}
zaterdag 19 februari 2011
vrijdag 20 augustus 2010
cusor/caret position
If you want to set your cursor to the end of a textarea or textfield, just set the focus first and then a value.
so:
self.rte.domCode.value += '';
self.rte.domCode.focus();
will put the focus at the start while
self.rte.domCode.focus();
self.rte.domCode.value += '';
will put it at the end :)
so:
self.rte.domCode.value += '';
self.rte.domCode.focus();
will put the focus at the start while
self.rte.domCode.focus();
self.rte.domCode.value += '';
will put it at the end :)
donderdag 20 mei 2010
chrome and safari form target
Chrome and Safari won't be able to find the target of a form, if it's not already extisting in the DOM tree, when the form is created.
So,
good:
bad:
Abonneren op:
Posts (Atom)