TimeZoneOffset if Zone changed on the go

peacemaker

Expert
Licensed User
Longtime User
If app is working, and the end-user changes the zone, or it changed automatically - how to be sure that app get zone correctly ?

My activities in "Sub Activity_Resume" calculate the datetime, but if Zone changed suddenly - no changes in datetime ...:-( App restart helps, but need to be sure any time !
 
Last edited:

peacemaker

Expert
Licensed User
Longtime User
Thanks, Erel !
But what should i do in the app when TIMEZONE_CHANGED has been caught ?
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Thanks, Erel.
For now the straigt solution can be so, i guess:

BroadcastReceiver in the Manifest:
B4X:
AddReceiverText(serviceNAME, 
<intent-filter>
    <action android:name="android.intent.action.TIMEZONE_CHANGED" />
</intent-filter>)

First Activity:
B4X:
Sub Activity_Create(FirstTime As Boolean)
If FirstTime then Zone = DateTime.TimeZoneOffset
...

Service serviceNAME:
B4X:
Sub Service_Start (StartingIntent As Intent)
If StartingIntent.Action = "android.intent.action.TIMEZONE_CHANGED" Then
   Dim tzid, a As String
   tzid = StartingIntent.GetExtra("time-zone")

   Zone = GetTimeZoneOffset(tzid)   'get current zone, used in the date\time operations
   'refresh needed activity's date\time
   If IsPaused(Device) = False Then CallSubDelayed(Device, "Activity_Resume")
   
   a = tzid & ": time zone has been changed, dates\times refreshed."
   ToastMessageShow(a, True)
End If
End Sub

And the main sub:
B4X:
Sub GetTimeZoneOffset(TimeZoneID As String) As Double
Dim a As Map
a.Initialize
a.Put("Africa/Abidjan", "0")
a.Put("Africa/Accra", "0")
a.Put("Africa/Addis_Ababa", "3")
a.Put("Africa/Algiers", "1")
a.Put("Africa/Asmara", "3")
a.Put("Africa/Asmera", "3")
a.Put("Africa/Bamako", "0")
a.Put("Africa/Bangui", "1")
a.Put("Africa/Banjul", "0")
a.Put("Africa/Bissau", "0")
a.Put("Africa/Blantyre", "2")
a.Put("Africa/Brazzaville", "1")
a.Put("Africa/Bujumbura", "2")
a.Put("Africa/Cairo", "2")
a.Put("Africa/Casablanca", "0")
a.Put("Africa/Ceuta", "1")
a.Put("Africa/Conakry", "0")
a.Put("Africa/Dakar", "0")
a.Put("Africa/Dar_es_Salaam", "3")
a.Put("Africa/Djibouti", "3")
a.Put("Africa/Douala", "1")
a.Put("Africa/El_Aaiun", "0")
a.Put("Africa/Freetown", "0")
a.Put("Africa/Gaborone", "2")
a.Put("Africa/Harare", "2")
a.Put("Africa/Johannesburg", "2")
a.Put("Africa/Juba", "3")
a.Put("Africa/Kampala", "3")
a.Put("Africa/Khartoum", "3")
a.Put("Africa/Kigali", "2")
a.Put("Africa/Kinshasa", "1")
a.Put("Africa/Lagos", "1")
a.Put("Africa/Libreville", "1")
a.Put("Africa/Lome", "0")
a.Put("Africa/Luanda", "1")
a.Put("Africa/Lubumbashi", "2")
a.Put("Africa/Lusaka", "2")
a.Put("Africa/Malabo", "1")
a.Put("Africa/Maputo", "2")
a.Put("Africa/Maseru", "2")
a.Put("Africa/Mbabane", "2")
a.Put("Africa/Mogadishu", "3")
a.Put("Africa/Monrovia", "0")
a.Put("Africa/Nairobi", "3")
a.Put("Africa/Ndjamena", "1")
a.Put("Africa/Niamey", "1")
a.Put("Africa/Nouakchott", "0")
a.Put("Africa/Ouagadougou", "0")
a.Put("Africa/Porto-Novo", "1")
a.Put("Africa/Sao_Tome", "0")
a.Put("Africa/Timbuktu", "0")
a.Put("Africa/Tripoli", "2")
a.Put("Africa/Tunis", "1")
a.Put("Africa/Windhoek", "1")
a.Put("AKST9AKDT", "-9")
a.Put("America/Adak", "-10")
a.Put("America/Anchorage", "-9")
a.Put("America/Anguilla", "-4")
a.Put("America/Antigua", "-4")
a.Put("America/Araguaina", "-3")
a.Put("America/Argentina/Buenos_Aires", "-3")
a.Put("America/Argentina/Catamarca", "-3")
a.Put("America/Argentina/ComodRivadavia", "-3")
a.Put("America/Argentina/Cordoba", "-3")
a.Put("America/Argentina/Jujuy", "-3")
a.Put("America/Argentina/La_Rioja", "-3")
a.Put("America/Argentina/Mendoza", "-3")
a.Put("America/Argentina/Rio_Gallegos", "-3")
a.Put("America/Argentina/Salta", "-3")
a.Put("America/Argentina/San_Juan", "-3")
a.Put("America/Argentina/San_Luis", "-3")
a.Put("America/Argentina/Tucuman", "-3")
a.Put("America/Argentina/Ushuaia", "-3")
a.Put("America/Aruba", "-4")
a.Put("America/Asuncion", "-4")
a.Put("America/Atikokan", "-5")
a.Put("America/Atka", "-10")
a.Put("America/Bahia", "-3")
a.Put("America/Bahia_Banderas", "-6")
a.Put("America/Barbados", "-4")
a.Put("America/Belem", "-3")
a.Put("America/Belize", "-6")
a.Put("America/Blanc-Sablon", "-4")
a.Put("America/Boa_Vista", "-4")
a.Put("America/Bogota", "-5")
a.Put("America/Boise", "-7")
a.Put("America/Buenos_Aires", "-3")
a.Put("America/Cambridge_Bay", "-7")
a.Put("America/Campo_Grande", "-4")
a.Put("America/Cancun", "-6")
a.Put("America/Caracas", "-4.5")
a.Put("America/Catamarca", "-3")
a.Put("America/Cayenne", "-3")
a.Put("America/Cayman", "-5")
a.Put("America/Chicago", "-6")
a.Put("America/Chihuahua", "-7")
a.Put("America/Coral_Harbour", "-5")
a.Put("America/Cordoba", "-3")
a.Put("America/Costa_Rica", "-6")
a.Put("America/Creston", "-7")
a.Put("America/Cuiaba", "-4")
a.Put("America/Curacao", "-4")
a.Put("America/Danmarkshavn", "0")
a.Put("America/Dawson", "-8")
a.Put("America/Dawson_Creek", "-7")
a.Put("America/Denver", "-7")
a.Put("America/Detroit", "-5")
a.Put("America/Dominica", "-4")
a.Put("America/Edmonton", "-7")
a.Put("America/Eirunepe", "-4")
a.Put("America/El_Salvador", "-6")
a.Put("America/Ensenada", "-8")
a.Put("America/Fort_Wayne", "-5")
a.Put("America/Fortaleza", "-3")
a.Put("America/Glace_Bay", "-4")
a.Put("America/Godthab", "-3")
a.Put("America/Goose_Bay", "-4")
a.Put("America/Grand_Turk", "-5")
a.Put("America/Grenada", "-4")
a.Put("America/Guadeloupe", "-4")
a.Put("America/Guatemala", "-6")
a.Put("America/Guayaquil", "-5")
a.Put("America/Guyana", "-4")
a.Put("America/Halifax", "-4")
a.Put("America/Havana", "-5")
a.Put("America/Hermosillo", "-7")
a.Put("America/Indiana/Indianapolis", "-5")
a.Put("America/Indiana/Knox", "-6")
a.Put("America/Indiana/Marengo", "-5")
a.Put("America/Indiana/Petersburg", "-5")
a.Put("America/Indiana/Tell_City", "-6")
a.Put("America/Indiana/Vevay", "-5")
a.Put("America/Indiana/Vincennes", "-5")
a.Put("America/Indiana/Winamac", "-5")
a.Put("America/Indianapolis", "-5")
a.Put("America/Inuvik", "-7")
a.Put("America/Iqaluit", "-5")
a.Put("America/Jamaica", "-5")
a.Put("America/Jujuy", "-3")
a.Put("America/Juneau", "-9")
a.Put("America/Kentucky/Louisville", "-5")
a.Put("America/Kentucky/Monticello", "-5")
a.Put("America/Knox_IN", "-6")
a.Put("America/Kralendijk", "-4")
a.Put("America/La_Paz", "-4")
a.Put("America/Lima", "-5")
a.Put("America/Los_Angeles", "-8")
a.Put("America/Louisville", "-5")
a.Put("America/Lower_Princes", "-4")
a.Put("America/Maceio", "-3")
a.Put("America/Managua", "-6")
a.Put("America/Manaus", "-4")
a.Put("America/Marigot", "-4")
a.Put("America/Martinique", "-4")
a.Put("America/Matamoros", "-6")
a.Put("America/Mazatlan", "-7")
a.Put("America/Mendoza", "-3")
a.Put("America/Menominee", "-6")
a.Put("America/Merida", "-6")
a.Put("America/Metlakatla", "-8")
a.Put("America/Mexico_City", "-6")
a.Put("America/Miquelon", "-3")
a.Put("America/Moncton", "-4")
a.Put("America/Monterrey", "-6")
a.Put("America/Montevideo", "-3")
a.Put("America/Montreal", "-5")
a.Put("America/Montserrat", "-4")
a.Put("America/Nassau", "-5")
a.Put("America/New_York", "-5")
a.Put("America/Nipigon", "-5")
a.Put("America/Nome", "-9")
a.Put("America/Noronha", "-2")
a.Put("America/North_Dakota/Beulah", "-6")
a.Put("America/North_Dakota/Center", "-6")
a.Put("America/North_Dakota/New_Salem", "-6")
a.Put("America/Ojinaga", "-7")
a.Put("America/Panama", "-5")
a.Put("America/Pangnirtung", "-5")
a.Put("America/Paramaribo", "-3")
a.Put("America/Phoenix", "-7")
a.Put("America/Port_of_Spain", "-4")
a.Put("America/Port-au-Prince", "-5")
a.Put("America/Porto_Acre", "-4")
a.Put("America/Porto_Velho", "-4")
a.Put("America/Puerto_Rico", "-4")
a.Put("America/Rainy_River", "-6")
a.Put("America/Rankin_Inlet", "-6")
a.Put("America/Recife", "-3")
a.Put("America/Regina", "-6")
a.Put("America/Resolute", "-6")
a.Put("America/Rio_Branco", "-4")
a.Put("America/Rosario", "-3")
a.Put("America/Santa_Isabel", "-8")
a.Put("America/Santarem", "-3")
a.Put("America/Santiago", "-4")
a.Put("America/Santo_Domingo", "-4")
a.Put("America/Sao_Paulo", "-3")
a.Put("America/Scoresbysund", "-1")
a.Put("America/Shiprock", "-7")
a.Put("America/Sitka", "-9")
a.Put("America/St_Barthelemy", "-4")
a.Put("America/St_Johns", "-3.5")
a.Put("America/St_Kitts", "-4")
a.Put("America/St_Lucia", "-4")
a.Put("America/St_Thomas", "-4")
a.Put("America/St_Vincent", "-4")
a.Put("America/Swift_Current", "-6")
a.Put("America/Tegucigalpa", "-6")
a.Put("America/Thule", "-4")
a.Put("America/Thunder_Bay", "-5")
a.Put("America/Tijuana", "-8")
a.Put("America/Toronto", "-5")
a.Put("America/Tortola", "-4")
a.Put("America/Vancouver", "-8")
a.Put("America/Virgin", "-4")
a.Put("America/Whitehorse", "-8")
a.Put("America/Winnipeg", "-6")
a.Put("America/Yakutat", "-9")
a.Put("America/Yellowknife", "-7")
a.Put("Antarctica/Casey", "11")
a.Put("Antarctica/Davis", "5")
a.Put("Antarctica/DumontDUrville", "10")
a.Put("Antarctica/Macquarie", "11")
a.Put("Antarctica/Mawson", "5")
a.Put("Antarctica/McMurdo", "12")
a.Put("Antarctica/Palmer", "-4")
a.Put("Antarctica/Rothera", "-3")
a.Put("Antarctica/South_Pole", "12")
a.Put("Antarctica/Syowa", "3")
a.Put("Antarctica/Vostok", "6")
a.Put("Arctic/Longyearbyen", "1")
a.Put("Asia/Aden", "3")
a.Put("Asia/Almaty", "6")
a.Put("Asia/Amman", "2")
a.Put("Asia/Anadyr", "12")
a.Put("Asia/Aqtau", "5")
a.Put("Asia/Aqtobe", "5")
a.Put("Asia/Ashgabat", "5")
a.Put("Asia/Ashkhabad", "5")
a.Put("Asia/Baghdad", "3")
a.Put("Asia/Bahrain", "3")
a.Put("Asia/Baku", "4")
a.Put("Asia/Bangkok", "7")
a.Put("Asia/Beirut", "2")
a.Put("Asia/Bishkek", "6")
a.Put("Asia/Brunei", "8")
a.Put("Asia/Calcutta", "5.5")
a.Put("Asia/Choibalsan", "8")
a.Put("Asia/Chongqing", "8")
a.Put("Asia/Chungking", "8")
a.Put("Asia/Colombo", "5.5")
a.Put("Asia/Dacca", "6")
a.Put("Asia/Damascus", "2")
a.Put("Asia/Dhaka", "6")
a.Put("Asia/Dili", "9")
a.Put("Asia/Dubai", "4")
a.Put("Asia/Dushanbe", "5")
a.Put("Asia/Gaza", "2")
a.Put("Asia/Harbin", "8")
a.Put("Asia/Hebron", "2")
a.Put("Asia/Ho_Chi_Minh", "7")
a.Put("Asia/Hong_Kong", "8")
a.Put("Asia/Hovd", "7")
a.Put("Asia/Irkutsk", "9")
a.Put("Asia/Istanbul", "2")
a.Put("Asia/Jakarta", "7")
a.Put("Asia/Jayapura", "9")
a.Put("Asia/Jerusalem", "2")
a.Put("Asia/Kabul", "4.5")
a.Put("Asia/Kamchatka", "12")
a.Put("Asia/Karachi", "5")
a.Put("Asia/Kashgar", "8")
a.Put("Asia/Kathmandu", "5.75")
a.Put("Asia/Katmandu", "5.75")
a.Put("Asia/Kolkata", "5.5")
a.Put("Asia/Krasnoyarsk", "8")
a.Put("Asia/Kuala_Lumpur", "8")
a.Put("Asia/Kuching", "8")
a.Put("Asia/Kuwait", "3")
a.Put("Asia/Macao", "8")
a.Put("Asia/Macau", "8")
a.Put("Asia/Magadan", "12")
a.Put("Asia/Makassar", "8")
a.Put("Asia/Manila", "8")
a.Put("Asia/Muscat", "4")
a.Put("Asia/Nicosia", "2")
a.Put("Asia/Novokuznetsk", "7")
a.Put("Asia/Novosibirsk", "7")
a.Put("Asia/Omsk", "7")
a.Put("Asia/Oral", "5")
a.Put("Asia/Phnom_Penh", "7")
a.Put("Asia/Pontianak", "7")
a.Put("Asia/Pyongyang", "9")
a.Put("Asia/Qatar", "3")
a.Put("Asia/Qyzylorda", "6")
a.Put("Asia/Rangoon", "6.5")
a.Put("Asia/Riyadh", "3")
a.Put("Asia/Saigon", "7")
a.Put("Asia/Sakhalin", "11")
a.Put("Asia/Samarkand", "5")
a.Put("Asia/Seoul", "9")
a.Put("Asia/Shanghai", "8")
a.Put("Asia/Singapore", "8")
a.Put("Asia/Taipei", "8")
a.Put("Asia/Tashkent", "5")
a.Put("Asia/Tbilisi", "4")
a.Put("Asia/Tehran", "3.5")
a.Put("Asia/Tel_Aviv", "2")
a.Put("Asia/Thimbu", "6")
a.Put("Asia/Thimphu", "6")
a.Put("Asia/Tokyo", "9")
a.Put("Asia/Ujung_Pandang", "8")
a.Put("Asia/Ulaanbaatar", "8")
a.Put("Asia/Ulan_Bator", "8")
a.Put("Asia/Urumqi", "8")
a.Put("Asia/Vientiane", "7")
a.Put("Asia/Vladivostok", "11")
a.Put("Asia/Yakutsk", "10")
a.Put("Asia/Yekaterinburg", "6")
a.Put("Asia/Yerevan", "4")
a.Put("Atlantic/Azores", "-1")
a.Put("Atlantic/Bermuda", "-4")
a.Put("Atlantic/Canary", "0")
a.Put("Atlantic/Cape_Verde", "-1")
a.Put("Atlantic/Faeroe", "0")
a.Put("Atlantic/Faroe", "0")
a.Put("Atlantic/Jan_Mayen", "1")
a.Put("Atlantic/Madeira", "0")
a.Put("Atlantic/Reykjavik", "0")
a.Put("Atlantic/South_Georgia", "-2")
a.Put("Atlantic/St_Helena", "0")
a.Put("Atlantic/Stanley", "-3")
a.Put("Australia/ACT", "10")
a.Put("Australia/Adelaide", "9.5")
a.Put("Australia/Brisbane", "10")
a.Put("Australia/Broken_Hill", "9.5")
a.Put("Australia/Canberra", "10")
a.Put("Australia/Currie", "10")
a.Put("Australia/Darwin", "9.5")
a.Put("Australia/Eucla", "8.75")
a.Put("Australia/Hobart", "10")
a.Put("Australia/LHI", "10.5")
a.Put("Australia/Lindeman", "10")
a.Put("Australia/Lord_Howe", "10.5")
a.Put("Australia/Melbourne", "10")
a.Put("Australia/North", "9.5")
a.Put("Australia/NSW", "10")
a.Put("Australia/Perth", "8")
a.Put("Australia/Queensland", "10")
a.Put("Australia/South", "9.5")
a.Put("Australia/Sydney", "10")
a.Put("Australia/Tasmania", "10")
a.Put("Australia/Victoria", "10")
a.Put("Australia/West", "8")
a.Put("Australia/Yancowinna", "9.5")
a.Put("Brazil/Acre", "-4")
a.Put("Brazil/DeNoronha", "-2")
a.Put("Brazil/East", "-3")
a.Put("Brazil/West", "-4")
a.Put("Canada/Atlantic", "-4")
a.Put("Canada/Central", "-6")
a.Put("Canada/Eastern", "-5")
a.Put("Canada/East-Saskatchewan", "-6")
a.Put("Canada/Mountain", "-7")
a.Put("Canada/Newfoundland", "-3.5")
a.Put("Canada/Pacific", "-8")
a.Put("Canada/Saskatchewan", "-6")
a.Put("Canada/Yukon", "-8")
a.Put("CET", "1")
a.Put("Chile/Continental", "-4")
a.Put("Chile/EasterIsland", "-6")
a.Put("CST6CDT", "-6")
a.Put("Cuba", "-5")
a.Put("EET", "2")
a.Put("Egypt", "2")
a.Put("Eire", "0")
a.Put("EST", "-5")
a.Put("EST5EDT", "-5")
a.Put("Etc./GMT", "0")
a.Put("Etc./GMT+0", "0")
a.Put("Etc./UCT", "0")
a.Put("Etc./Universal", "0")
a.Put("Etc./UTC", "0")
a.Put("Etc./Zulu", "0")
a.Put("Europe/Amsterdam", "1")
a.Put("Europe/Andorra", "1")
a.Put("Europe/Athens", "2")
a.Put("Europe/Belfast", "0")
a.Put("Europe/Belgrade", "1")
a.Put("Europe/Berlin", "1")
a.Put("Europe/Bratislava", "1")
a.Put("Europe/Brussels", "1")
a.Put("Europe/Bucharest", "2")
a.Put("Europe/Budapest", "1")
a.Put("Europe/Chisinau", "2")
a.Put("Europe/Copenhagen", "1")
a.Put("Europe/Dublin", "0")
a.Put("Europe/Gibraltar", "1")
a.Put("Europe/Guernsey", "0")
a.Put("Europe/Helsinki", "2")
a.Put("Europe/Isle_of_Man", "0")
a.Put("Europe/Istanbul", "2")
a.Put("Europe/Jersey", "0")
a.Put("Europe/Kaliningrad", "3")
a.Put("Europe/Kiev", "2")
a.Put("Europe/Lisbon", "0")
a.Put("Europe/Ljubljana", "1")
a.Put("Europe/London", "0")
a.Put("Europe/Luxembourg", "1")
a.Put("Europe/Madrid", "1")
a.Put("Europe/Malta", "1")
a.Put("Europe/Mariehamn", "2")
a.Put("Europe/Minsk", "3")
a.Put("Europe/Monaco", "1")
a.Put("Europe/Moscow", "4")
a.Put("Europe/Nicosia", "2")
a.Put("Europe/Oslo", "1")
a.Put("Europe/Paris", "1")
a.Put("Europe/Podgorica", "1")
a.Put("Europe/Prague", "1")
a.Put("Europe/Riga", "2")
a.Put("Europe/Rome", "1")
a.Put("Europe/Samara", "4")
a.Put("Europe/San_Marino", "1")
a.Put("Europe/Sarajevo", "1")
a.Put("Europe/Simferopol", "2")
a.Put("Europe/Skopje", "1")
a.Put("Europe/Sofia", "2")
a.Put("Europe/Stockholm", "1")
a.Put("Europe/Tallinn", "2")
a.Put("Europe/Tirane", "1")
a.Put("Europe/Tiraspol", "2")
a.Put("Europe/Uzhgorod", "2")
a.Put("Europe/Vaduz", "1")
a.Put("Europe/Vatican", "1")
a.Put("Europe/Vienna", "1")
a.Put("Europe/Vilnius", "2")
a.Put("Europe/Volgograd", "4")
a.Put("Europe/Warsaw", "1")
a.Put("Europe/Zagreb", "1")
a.Put("Europe/Zaporozhye", "2")
a.Put("Europe/Zurich", "1")
a.Put("GB", "0")
a.Put("GB-Eire", "0")
a.Put("GMT", "0")
a.Put("GMT+0", "0")
a.Put("GMT0", "0")
a.Put("GMT-0", "0")
a.Put("Greenwich", "0")
a.Put("Hong Kong", "8")
a.Put("HST", "-10")
a.Put("Iceland", "0")
a.Put("Indian/Antananarivo", "3")
a.Put("Indian/Chagos", "6")
a.Put("Indian/Christmas", "7")
a.Put("Indian/Cocos", "6.5")
a.Put("Indian/Comoro", "3")
a.Put("Indian/Kerguelen", "5")
a.Put("Indian/Mahe", "4")
a.Put("Indian/Maldives", "5")
a.Put("Indian/Mauritius", "4")
a.Put("Indian/Mayotte", "3")
a.Put("Indian/Reunion", "4")
a.Put("Iran", "3.5")
a.Put("Israel", "2")
a.Put("Jamaica", "-5")
a.Put("Japan", "9")
a.Put("JST-9", "9")
a.Put("Kwajalein", "12")
a.Put("Libya", "2")
a.Put("MET", "1")
a.Put("Mexico/BajaNorte", "-8")
a.Put("Mexico/BajaSur", "-7")
a.Put("Mexico/General", "-6")
a.Put("MST", "-7")
a.Put("MST7MDT", "-7")
a.Put("Navajo", "-7")
a.Put("NZ", "12")
a.Put("NZ-CHAT", "12.75")
a.Put("Pacific/Apia", "13")
a.Put("Pacific/Auckland", "12")
a.Put("Pacific/Chatham", "12.75")
a.Put("Pacific/Chuuk", "10")
a.Put("Pacific/Easter", "-6")
a.Put("Pacific/Efate", "11")
a.Put("Pacific/Enderbury", "13")
a.Put("Pacific/Fakaofo", "13")
a.Put("Pacific/Fiji", "12")
a.Put("Pacific/Funafuti", "12")
a.Put("Pacific/Galapagos", "-6")
a.Put("Pacific/Gambier", "-9")
a.Put("Pacific/Guadalcanal", "11")
a.Put("Pacific/Guam", "10")
a.Put("Pacific/Honolulu", "-10")
a.Put("Pacific/Johnston", "-10")
a.Put("Pacific/Kiritimati", "14")
a.Put("Pacific/Kosrae", "11")
a.Put("Pacific/Kwajalein", "12")
a.Put("Pacific/Majuro", "12")
a.Put("Pacific/Marquesas", "-9.5")
a.Put("Pacific/Midway", "-11")
a.Put("Pacific/Nauru", "12")
a.Put("Pacific/Niue", "-11")
a.Put("Pacific/Norfolk", "11.5")
a.Put("Pacific/Noumea", "11")
a.Put("Pacific/Pago_Pago", "-11")
a.Put("Pacific/Palau", "9")
a.Put("Pacific/Pitcairn", "-8")
a.Put("Pacific/Pohnpei", "11")
a.Put("Pacific/Ponape", "11")
a.Put("Pacific/Port_Moresby", "10")
a.Put("Pacific/Rarotonga", "-10")
a.Put("Pacific/Saipan", "10")
a.Put("Pacific/Samoa", "-11")
a.Put("Pacific/Tahiti", "-10")
a.Put("Pacific/Tarawa", "12")
a.Put("Pacific/Tongatapu", "13")
a.Put("Pacific/Truk", "10")
a.Put("Pacific/Wake", "12")
a.Put("Pacific/Wallis", "12")
a.Put("Pacific/Yap", "10")
a.Put("Poland", "1")
a.Put("Portugal", "0")
a.Put("PRC", "8")
a.Put("PST8PDT", "-8")
a.Put("ROC", "8")
a.Put("ROK", "9")
a.Put("Singapore", "8")
a.Put("Turkey", "2")
a.Put("UCT", "0")
a.Put("Universal", "0")
a.Put("US/Alaska", "-9")
a.Put("US/Aleutian", "-10")
a.Put("US/Arizona", "-7")
a.Put("US/Central", "-6")
a.Put("US/Eastern", "-5")
a.Put("US/East-Indiana", "-5")
a.Put("US/Hawaii", "-10")
a.Put("US/Indiana-Starke", "-6")
a.Put("US/Michigan", "-5")
a.Put("US/Mountain", "-7")
a.Put("US/Pacific", "-8")
a.Put("US/Pacific-New", "-8")
a.Put("US/Samoa", "-11")
a.Put("UTC", "0")
a.Put("WET", "0")
a.Put("W-SU", "4")
a.Put("Zulu", "0")

If a.ContainsKey(TimeZoneID) Then
   Return a.Get(TimeZoneID)
Else
   Return DateTime.TimeZoneOffset
End If
End Sub

I guess, can be useful for somebody in the community.
 
Last edited:
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Oh, no...
I see at last that DateTime internal calculations are including the zone. That now is not updated internally, if changed....
:-((((
it'd be appreciated for some beta-version with updating DateTime to test... :-( without it cannot develop further :(
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
If you update DateTime internal code in a next B4A version - would it be better ?
 
Upvote 0

Pantelis

Member
Licensed User
Longtime User
You can add an intent filter with the following action: android.intent.action.TIMEZONE_CHANGED

The problem is that currently there is no way to reset DateTime time zone. I will add such an option in the next update.

Erel is it now possible to reset DateTime time zone with version 2.71?
 
Upvote 0
Top