CarlD Posted December 21, 2024 Posted December 21, 2024 (edited) Revised based on comments from @argumentum. Script now uses the time server at timeapi.io. Expanded list of available cities. 2024-12-27: Added code from @argumentum to support passing command-line args in SciTE. expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=TimeIn.exe #AutoIt3Wrapper_UseUpx=y #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Run_Au3Stripper=y #AutoIt3Wrapper_AU3Check_Parameters=-w 3 -w 4 -w 5 -w 6 -d #AutoIt3Wrapper_Change2CUI=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; #include <Date.au3> ; World Time via API at https://timeapi.io Global $sRevDate = "[CLD rev. 2024-12-27]" ; If $CmdLine[0] = 0 Then Exit _ShowHelp() If StringInStr($CmdLine[1], "?") Then Exit _ShowHelp() Global $aData, $aDow, $aDTm, $aFrac = "", $aSubst, $aTZdata Global $bPossDST = 0, $DTadj, $DTime, $h1, $h2 Global $iDoW, $iIncr = 0, $iMatch Global $sData = "", $sOut = "", $sSubst, $iTmp Global $sTail = "", $sTZdata, $sWhere = "" Global $sURL = "https://timeapi.io/api/time/current/zone?timeZone=" If $CmdLine[0] Then $sWhere = $CmdLineRaw If StringInStr($sWhere, @ScriptFullPath) Then $sWhere = StringStripWS(StringTrimLeft($sWhere, StringInStr($sWhere, @ScriptFullPath) + StringLen(@ScriptFullPath)), 3) ConsoleWrite(">" & $sWhere & "<" & @CrLF) EndIf If StringInStr($sWhere, " ") Then $sWhere = StringReplace($sWhere, " ", "_") If StringInStr($sWhere, ".") Then $sWhere = StringReplace($sWhere, ".", "") If StringInStr($sWhere, "UTC+") Then $sWhere = StringReplace($sWhere, "UTC+", "GMT+") If StringInStr($sWhere, "UTC-") Then $sWhere = StringReplace($sWhere, "UTC-", "GMT-") If StringInStr($sWhere, "GMT+") Then $sWhere = StringReplace($sWhere, "GMT+", "GMT-") If StringInStr($sWhere, "GMT-") Then $sWhere = StringReplace($sWhere, "GMT-", "GMT+") ; Supplemental list of cities not in IANA time zone list ; Substitutes time zone for city name ; GMT offsets use opposite sign -/+ (quirk of time zone data format) $sSubst = "EST5EDT,Miami,Atlanta,Boston,Philadelphia,|CST6CDT,New_Orleans,Minneapolis,Kansas_City,Oklahoma_City,Dallas,Houston,|MST7MDT,Salt_Lake_City,|PST8PDT,San_Diego,San_Francisco,Las_Vegas,Seattle,|GMT,Douglas,Jamestown,Lome,Lomé,Edinburgh,Cardiff,Suva,Yaren,Pevek,Petropavlovsk-Kamchatsky,Yamoussoukro,Torshavn,Tórshavn,|GMT-1,Tirana,Porto_Novo,Yaounde,Yaoundé,N'Djamena,Frankfurt,Valletta,Catania,Rabat*,Abuja,Tromso,Barcelona,Bern,Vatican_City,|GMT-2,Benghazi,Gitega,Kemi,Rovaniemi,Lilongwe,Cape_Town,Pretoria,Dnipro,|GMT-3,Doha,|GMT-4,Port_Louis,Saint-Denis,Izhevsk,Seychelles,Abu_Dhabi,|GMT-5,Port-aux-Francais,Amsterdam_Island,Astana,Male,Islamabad,Lahore,|GMT-5:30,New_Delhi,Bengaluru,Mumbai,Bombay,Chennai,Sri_Jayawardenepura_Kotte,|GMT-6,Diego_Garcia,|GMT-6:30,Naypyidaw,|GMT-7,Khatanga,Norilsk,Hanoi,|GMT-8,Bandar_Seri_Begawan,Beijing,Lhasa,Denpasar,Nusantara,|GMT-9,Manokwari,Ngerulmud,Tiksi,|GMT-9:30,Alice_Springs,|GMT-10,Cairns,Hagatna,Hagåtña,Komsomolsk-on-Amur,Verkhoyansk,|GMT-11,Palikir,Yuzhno-Sakhalinsk,Honiara,Port_Vila,|GMT+1,Praia,Ponta_Delgada,|GMT+2,Ittoqqortoormiit,Kangerlussuaq,Qaanaaq,King_Edward_Point,|GMT+3,Brasilia,Rio_de_Janeiro,Punta_Arenas*,Santiago*,|GMT+3:30,Mary's_Harbour,|GMT+4,Bridgetown,Hamilton,Sucre,Happy_Valley-Thule_Air_Base,Basse-Terre,Georgetown,|GMT+5,Alert,Eureka,Grise_Fiord,Pond_Inlet,Ottawa,Chibougamau,Kuujjuaq,Easter_Island*,Quito,Kingston,|GMT+6,Belmopan,Baker_Lake,Resolute_Bay,San_Jose,Galapagos_Islands,San_Salvador,Guatemala_City,|GMT+7,Calgary,|GMT+8,Adamstown,|GMT+9,Fairbanks,Unalaska,|GMT+10,Papeete,|GMT+11,Dodoma,Alofi,Ankara,Sana,Manama,Moroni,Kuwait_City,Belushya_Guba,Marion_Island_(Prince_Edward_Islands),Marion_Island,|GMT+12,Baker_Island," $aSubst = StringSplit($sSubst, "|") For $i = 1 To $aSubst[0] If StringInStr($aSubst[$i], ("," & $sWhere)) Then If StringInStr($aSubst[$i], ("," & $sWhere & "*")) Then $sWhere &= "*" $bPossDST = 1 EndIf If StringInStr($aSubst[$i], ("," & $sWhere & ",")) Then $sWhere = _ StringLeft($aSubst[$i], StringInStr($aSubst[$i], ",") - 1) If StringInStr($sWhere, "GMT") = 1 Then $sWhere = "Etc/" & $sWhere EndIf Next ; Fractional UTC/GMT offsets If StringInStr($sWhere, ":") Then $aFrac = StringSplit($sWhere, ":") $sWhere = $aFrac[1] $iIncr = $aFrac[2] If StringInStr($sWhere, "+") Then $iIncr *= -1 EndIf $sTZdata = "Africa/Abidjan,Africa/Accra,Africa/Addis_Ababa,Africa/Algiers,Africa/Asmara,Africa/Asmera,Africa/Bamako,Africa/Bangui,Africa/Banjul,Africa/Bissau,Africa/Blantyre,Africa/Brazzaville,Africa/Bujumbura,Africa/Cairo,Africa/Casablanca,Africa/Ceuta,Africa/Conakry,Africa/Dakar,Africa/Dar_es_Salaam,Africa/Djibouti,Africa/Douala,Africa/El_Aaiun,Africa/Freetown,Africa/Gaborone,Africa/Harare,Africa/Johannesburg,Africa/Juba,Africa/Kampala,Africa/Khartoum,Africa/Kigali,Africa/Kinshasa,Africa/Lagos,Africa/Libreville,Africa/Lome,Africa/Luanda,Africa/Lubumbashi,Africa/Lusaka,Africa/Malabo,Africa/Maputo,Africa/Maseru,Africa/Mbabane,Africa/Mogadishu,Africa/Monrovia,Africa/Nairobi,Africa/Ndjamena,Africa/Niamey,Africa/Nouakchott,Africa/Ouagadougou,Africa/Porto-Novo,Africa/Sao_Tome,Africa/Timbuktu,Africa/Tripoli,Africa/Tunis,Africa/Windhoek,America/Adak,America/Anchorage,America/Anguilla,America/Antigua,America/Araguaina,America/Argentina/Buenos_Aires,America/Argentina/Catamarca,America/Argentina/ComodRivadavia,America/Argentina/Cordoba,America/Argentina/Jujuy,America/Argentina/La_Rioja,America/Argentina/Mendoza,America/Argentina/Rio_Gallegos,America/Argentina/Salta,America/Argentina/San_Juan,America/Argentina/San_Luis,America/Argentina/Tucuman,America/Argentina/Ushuaia,America/Aruba,America/Asuncion,America/Atikokan,America/Atka,America/Bahia,America/Bahia_Banderas,America/Barbados,America/Belem,America/Belize,America/Blanc-Sablon,America/Boa_Vista,America/Bogota,America/Boise,America/Buenos_Aires,America/Cambridge_Bay,America/Campo_Grande,America/Cancun,America/Caracas,America/Catamarca,America/Cayenne,America/Cayman,America/Chicago,America/Chihuahua,America/Ciudad_Juarez,America/Coral_Harbour,America/Cordoba,America/Costa_Rica,America/Creston,America/Cuiaba,America/Curacao,America/Danmarkshavn,America/Dawson,America/Dawson_Creek,America/Denver,America/Detroit,America/Dominica,America/Edmonton,America/Eirunepe,America/El_Salvador,America/Ensenada,America/Fort_Nelson,America/Fort_Wayne,America/Fortaleza,America/Glace_Bay,America/Godthab,America/Goose_Bay,America/Grand_Turk,America/Grenada,America/Guadeloupe,America/Guatemala,America/Guayaquil,America/Guyana,America/Halifax,America/Havana,America/Hermosillo,America/Indiana/Indianapolis,America/Indiana/Knox,America/Indiana/Marengo,America/Indiana/Petersburg,America/Indiana/Tell_City,America/Indiana/Vevay,America/Indiana/Vincennes,America/Indiana/Winamac,America/Indianapolis,America/Inuvik,America/Iqaluit,America/Jamaica,America/Jujuy,America/Juneau,America/Kentucky/Louisville,America/Kentucky/Monticello,America/Knox_IN,America/Kralendijk,America/La_Paz,America/Lima,America/Los_Angeles,America/Louisville,America/Lower_Princes,America/Maceio,America/Managua,America/Manaus,America/Marigot,America/Martinique,America/Matamoros,America/Mazatlan,America/Mendoza,America/Menominee,America/Merida,America/Metlakatla,America/Mexico_City,America/Miquelon,America/Moncton,America/Monterrey,America/Montevideo,America/Montreal,America/Montserrat,America/Nassau,America/New_York,America/Nipigon,America/Nome,America/Noronha,America/North_Dakota/Beulah,America/North_Dakota/Center,America/North_Dakota/New_Salem,America/Nuuk,America/Ojinaga,America/Panama,America/Pangnirtung,America/Paramaribo,America/Phoenix,America/Port_of_Spain,America/Port-au-Prince,America/Porto_Acre,America/Porto_Velho,America/Puerto_Rico,America/Punta_Arenas,America/Rainy_River,America/Rankin_Inlet,America/Recife,America/Regina,America/Resolute,America/Rio_Branco,America/Rosario,America/Santa_Isabel,America/Santarem,America/Santiago,America/Santo_Domingo,America/Sao_Paulo,America/Scoresbysund,America/Shiprock,America/Sitka,America/St_Barthelemy,America/St_Johns,America/St_Kitts," $sTZdata &= "America/St_Lucia,America/St_Thomas,America/St_Vincent,America/Swift_Current,America/Tegucigalpa,America/Thule,America/Thunder_Bay,America/Tijuana,America/Toronto,America/Tortola,America/Vancouver,America/Virgin,America/Whitehorse,America/Winnipeg,America/Yakutat,America/Yellowknife,Antarctica/Casey,Antarctica/Davis,Antarctica/DumontDUrville,Antarctica/Macquarie,Antarctica/Mawson,Antarctica/McMurdo,Antarctica/Palmer,Antarctica/Rothera,Antarctica/South_Pole,Antarctica/Syowa,Antarctica/Troll,Antarctica/Vostok,Arctic/Longyearbyen,Asia/Aden,Asia/Almaty,Asia/Amman,Asia/Anadyr,Asia/Aqtau,Asia/Aqtobe,Asia/Ashgabat,Asia/Ashkhabad,Asia/Atyrau,Asia/Baghdad,Asia/Bahrain,Asia/Baku,Asia/Bangkok,Asia/Barnaul,Asia/Beirut,Asia/Bishkek,Asia/Brunei,Asia/Calcutta,Asia/Chita,Asia/Choibalsan,Asia/Chongqing,Asia/Chungking,Asia/Colombo,Asia/Dacca,Asia/Damascus,Asia/Dhaka,Asia/Dili,Asia/Dubai,Asia/Dushanbe,Asia/Famagusta,Asia/Gaza,Asia/Harbin,Asia/Hebron,Asia/Ho_Chi_Minh,Asia/Hong_Kong,Asia/Hovd,Asia/Irkutsk,Asia/Istanbul,Asia/Jakarta,Asia/Jayapura,Asia/Jerusalem,Asia/Kabul,Asia/Kamchatka,Asia/Karachi,Asia/Kashgar,Asia/Kathmandu,Asia/Katmandu,Asia/Khandyga,Asia/Kolkata,Asia/Krasnoyarsk,Asia/Kuala_Lumpur,Asia/Kuching,Asia/Kuwait,Asia/Macao,Asia/Macau,Asia/Magadan,Asia/Makassar,Asia/Manila,Asia/Muscat,Asia/Nicosia,Asia/Novokuznetsk,Asia/Novosibirsk,Asia/Omsk,Asia/Oral,Asia/Phnom_Penh,Asia/Pontianak,Asia/Pyongyang,Asia/Qatar,Asia/Qostanay,Asia/Qyzylorda,Asia/Rangoon,Asia/Riyadh,Asia/Saigon,Asia/Sakhalin,Asia/Samarkand,Asia/Seoul,Asia/Shanghai,Asia/Singapore,Asia/Srednekolymsk,Asia/Taipei,Asia/Tashkent,Asia/Tbilisi,Asia/Tehran,Asia/Tel_Aviv,Asia/Thimbu,Asia/Thimphu,Asia/Tokyo,Asia/Tomsk,Asia/Ujung_Pandang,Asia/Ulaanbaatar,Asia/Ulan_Bator,Asia/Urumqi,Asia/Ust-Nera,Asia/Vientiane,Asia/Vladivostok,Asia/Yakutsk,Asia/Yangon,Asia/Yekaterinburg,Asia/Yerevan,Atlantic/Azores,Atlantic/Bermuda,Atlantic/Canary,Atlantic/Cape_Verde,Atlantic/Faeroe,Atlantic/Faroe,Atlantic/Jan_Mayen,Atlantic/Madeira,Atlantic/Reykjavik,Atlantic/South_Georgia,Atlantic/St_Helena,Atlantic/Stanley,Australia/ACT,Australia/Adelaide,Australia/Brisbane,Australia/Broken_Hill,Australia/Canberra,Australia/Currie,Australia/Darwin,Australia/Eucla,Australia/Hobart,Australia/LHI,Australia/Lindeman,Australia/Lord_Howe,Australia/Melbourne,Australia/North,Australia/NSW,Australia/Perth,Australia/Queensland,Australia/South,Australia/Sydney,Australia/Tasmania,Australia/Victoria,Australia/West,Australia/Yancowinna,Brazil/Acre,Brazil/DeNoronha,Brazil/East,Brazil/West,Canada/Atlantic,Canada/Central,Canada/Eastern,Canada/Mountain,Canada/Newfoundland,Canada/Pacific,Canada/Saskatchewan,Canada/Yukon,CET,Chile/Continental,Chile/EasterIsland,CST6CDT,Cuba,EET,Egypt,Eire,EST,EST5EDT,Etc/GMT,Etc/GMT-0,Etc/GMT-1,Etc/GMT-10,Etc/GMT-11,Etc/GMT-12,Etc/GMT-13,Etc/GMT-14,Etc/GMT-2,Etc/GMT-3,Etc/GMT-4,Etc/GMT-5,Etc/GMT-6,Etc/GMT-7,Etc/GMT-8,Etc/GMT-9,Etc/GMT+0,Etc/GMT+1,Etc/GMT+10,Etc/GMT+11,Etc/GMT+12,Etc/GMT+2,Etc/GMT+3,Etc/GMT+4,Etc/GMT+5,Etc/GMT+6,Etc/GMT+7,Etc/GMT+8,Etc/GMT+9,Etc/GMT0,Etc/Greenwich,Etc/UCT,Etc/Universal,Etc/UTC,Etc/Zulu,Europe/Amsterdam,Europe/Andorra,Europe/Astrakhan,Europe/Athens,Europe/Belfast,Europe/Belgrade,Europe/Berlin,Europe/Bratislava,Europe/Brussels,Europe/Bucharest,Europe/Budapest,Europe/Busingen,Europe/Chisinau,Europe/Copenhagen,Europe/Dublin,Europe/Gibraltar,Europe/Guernsey," $sTZdata &= "Europe/Helsinki,Europe/Isle_of_Man,Europe/Istanbul,Europe/Jersey,Europe/Kaliningrad,Europe/Kiev,Europe/Kirov,Europe/Kyiv,Europe/Lisbon,Europe/Ljubljana,Europe/London,Europe/Luxembourg,Europe/Madrid,Europe/Malta,Europe/Mariehamn,Europe/Minsk,Europe/Monaco,Europe/Moscow,Europe/Nicosia,Europe/Oslo,Europe/Paris,Europe/Podgorica,Europe/Prague,Europe/Riga,Europe/Rome,Europe/Samara,Europe/San_Marino,Europe/Sarajevo,Europe/Saratov,Europe/Simferopol,Europe/Skopje,Europe/Sofia,Europe/Stockholm,Europe/Tallinn,Europe/Tirane,Europe/Tiraspol,Europe/Ulyanovsk,Europe/Uzhgorod,Europe/Vaduz,Europe/Vatican,Europe/Vienna,Europe/Vilnius,Europe/Volgograd,Europe/Warsaw,Europe/Zagreb,Europe/Zaporozhye,Europe/Zurich,GB,GB-Eire,GMT,GMT-0,GMT+0,GMT0,Greenwich,Hongkong,HST,Iceland,Indian/Antananarivo,Indian/Chagos,Indian/Christmas,Indian/Cocos,Indian/Comoro,Indian/Kerguelen,Indian/Mahe,Indian/Maldives,Indian/Mauritius,Indian/Mayotte,Indian/Reunion,Iran,Israel,Jamaica,Japan,Kwajalein,Libya,MET,Mexico/BajaNorte,Mexico/BajaSur,Mexico/General,MST,MST7MDT,Navajo,NZ,NZ-CHAT,Pacific/Apia,Pacific/Auckland,Pacific/Bougainville,Pacific/Chatham,Pacific/Chuuk,Pacific/Easter,Pacific/Efate,Pacific/Enderbury,Pacific/Fakaofo,Pacific/Fiji,Pacific/Funafuti,Pacific/Galapagos,Pacific/Gambier,Pacific/Guadalcanal,Pacific/Guam,Pacific/Honolulu,Pacific/Johnston,Pacific/Kanton,Pacific/Kiritimati,Pacific/Kosrae,Pacific/Kwajalein,Pacific/Majuro,Pacific/Marquesas,Pacific/Midway,Pacific/Nauru,Pacific/Niue,Pacific/Norfolk,Pacific/Noumea,Pacific/Pago_Pago,Pacific/Palau,Pacific/Pitcairn,Pacific/Pohnpei,Pacific/Ponape,Pacific/Port_Moresby,Pacific/Rarotonga,Pacific/Saipan,Pacific/Samoa,Pacific/Tahiti,Pacific/Tarawa,Pacific/Tongatapu,Pacific/Truk,Pacific/Wake,Pacific/Wallis,Pacific/Yap,Poland,Portugal,PRC,PST8PDT,ROC,ROK,Singapore,Turkey,UCT,Universal,US/Alaska,US/Aleutian,US/Arizona,US/Central,US/East-Indiana,US/Eastern,US/Hawaii,US/Indiana-Starke,US/Michigan,US/Mountain,US/Pacific,US/Samoa,UTC,W-SU,WET,Zulu" $sSubst = StringReplace($sSubst, "_", " ") $sSubst = StringReplace($sSubst, "*", "") $sTZdata &= $sSubst $aTZdata = StringSplit($sTZdata, ",") $iMatch = _ListMatches($sWhere) If Not $iMatch Then If Not $sOut Then $sOut = "Nothing on """ & $sWhere & """" Exit ConsoleWrite($sOut) EndIf $sTail = $aTZdata[$iMatch] $sURL &= $sTail $sData = BinaryToString(InetRead($sURL)) If Not $sData Then _ExitError("No data received") $aData = StringSplit($sData, ",") $aDow = StringSplit("Mon|Tue|Wed|Thu|Fri|Sat|Sun", "|") If $iIncr = 0 Then $sOut &= StringMid($aData[12], 14, 3) & " " $sOut &= StringTrimLeft($aData[10], 8) $sOut = StringTrimRight($sOut, 1) If StringInStr($aData[13], "true") Then $sOut &= " (DST)" Else $DTime = StringReplace(StringMid($aData[8], 13, 16), "-", "/") $DTime = StringReplace($DTime, "T", " ") $DTadj = _DateAdd("n", $iIncr, $DTime) $aDTm = StringSplit(StringLeft($DTadj, 10), "/") $iDoW = _DateToDayofWeek($aDTm[1], $aDTm[2], $aDTm[3]) - 1 If $iDoW < 1 Then $iDoW = 7 $sOut &= $aDoW[$iDoW] & " " & StringRight($DTadj, 5) EndIf If $bPossDST Then $sOut &= @CRLF & "(possibly plus|minus DST offset)" Exit ConsoleWrite($sOut & @CRLF) Func _ListMatches($sStr = "") Local $iCount = 0, $iIndex = 0, $sFixGMT = "", $sStr0 = "" If $sStr Then For $i = 1 To $aTZdata[0] If StringInStr($aTZdata[$i], $sStr) = 0 Or _ StringInStr($aTZdata[$i], "|") = 1 Then ContinueLoop $iIndex = $i $sStr0 = $aTZdata[$i] If StringInStr($sStr0, "/") And Not StringInStr($sStr0, "Etc/") Then $sStr0 = StringSplit($sStr0, "/")[2] If $sStr0 = $sStr Then $sFixGMT = $aTZdata[$i] If StringInStr($sFixGMT, "Etc/") = 1 Then $sFixGMT = StringReplace($aTZdata[$i], "Etc/GMT", "UTC/GMT") If StringInStr($sFixGMT, "+") = 8 Then $sFixGMT = StringReplace($sFixGMT, "+", "-") ElseIf StringInStr($sFixGMT, "-") = 8 Then $sFixGMT = StringReplace($sFixGMT, "-", "+") EndIf EndIf If $iIncr > 0 Then $sFixGMT &= ":" & String(Abs($iIncr)) $sOut &= $sFixGMT & " " Return $iIndex EndIf $iCount += 1 If $iCount = 2 Then $sOut &= @CRLF If StringInStr($aTZdata[$i], "Etc/") = 0 Then $sOut &= $aTZdata[$i] & " " If $iCount > 1 Then $sOut &= @CRLF EndIf Next EndIf If Not $iCount Then _ExitError("Nothing on """ & $sStr & """") Else If $iCount > 1 Then $iCount = 0 Else $iCount = $iIndex EndIf EndIf Return $iCount EndFunc ;==>_ListMatches Func _ExitError($sStr = "") If $sStr Then ConsoleWrite($sStr & @CRLF) Exit EndFunc ;==>_ExitError Func _ShowHelp() ConsoleWrite("World Time via timeapi.io " & $sRevDate & @CRLF & "Usage:" & @CRLF & StringTrimRight(@ScriptName, 4) & " <CITY>" & @CRLF & "--" & @CRLF & StringTrimRight(@ScriptName, 4) & " <substring> lists cities in database containing <substring>" & @CRLF & "Listings in format <continent>/<city> (e.g., Europe/Lisbon) obtain" & @CRLF & " the current time from the server at timeapi.io." & @CRLF & "Listings with city name only obtain the time based on the applicable" & @CRLF & " UTC/GMT offset identified in www.timeanddate.com." & @CRLF & "Accuracy is NOT guaranteed!" & @CRLF) EndFunc ;==>_ShowHelp Edited December 28, 2024 by CarlD argumentum 1
argumentum Posted December 21, 2024 Posted December 21, 2024 31 minutes ago, CarlD said: Times are obtained from the server at worldtimeapi.org. expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=F:\Dropbox\AutoIt\TimeIn.exe #AutoIt3Wrapper_UseUpx=y #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Run_Au3Stripper=y #AutoIt3Wrapper_AU3Check_Parameters=-w 3 -w 4 -w 5 -w 6 -d #AutoIt3Wrapper_Change2CUI=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; #include <Date.au3> ; World Time via API at worldtimeapi.org Global $sRevDate = "[CLD rev. 2024-12-21]" ; If $CmdLine[0] = 0 Then Exit _ShowHelp() If StringInStr($CmdLine[1], "?") Then Exit _ShowHelp() Global $aData, $aDow, $aDTm, $aFrac = "", $aSubst, $aTZdata Global $bPossDST = 0, $DTadj, $DTime, $h1, $h2 Global $sDoW, $iDoW0, $iDoW1, $iIncr = 0, $iMatch Global $sData = "", $sDataFn = @ScriptDir & "\timedat.dat" Global $sOut = "", $sSubst, $iTmp Global $sTail = "", $sTZdata, $sWhere = "" Global $sURL = "http://worldtimeapi.org/api/timezone/" If $CmdLine[0] Then $sWhere = $CmdLineRaw If StringInStr($sWhere, " ") Then $sWhere = StringReplace($sWhere, " ", "_") If StringInStr($sWhere, ".") Then $sWhere = StringReplace($sWhere, ".", "") If StringInStr($sWhere, "UTC+") Then $sWhere = StringReplace($sWhere, "UTC+", "GMT+") If StringInStr($sWhere, "UTC-") Then $sWhere = StringReplace($sWhere, "UTC-", "GMT-") If StringInStr($sWhere, "GMT+") Then $sWhere = StringReplace($sWhere, "GMT+", "GMT-") If StringInStr($sWhere, "GMT-") Then $sWhere = StringReplace($sWhere, "GMT-", "GMT+") ; Substitution table ; GMT offsets use opposite sign -/+ (quirk of WorldTimeAPI data format) $sSubst = "EST5EDT,Washington,Washington_DC,DC,Miami,Atlanta,Boston,Philadelphia,|CST6CDT,New_Orleans,Minneapolis,Kansas_City,Oklahoma_City,Dallas,Houston,|MST7MDT,Salt_Lake_City,|PST8PDT,San_Diego,San_Francisco,Las_Vegas,Seattle,|GMT,Reykjavik,Douglas,Bamako,Timbuktu,Nouakchott,Jamestown,Dakar,Freetown,Lomé,Greenwich,Edinburgh,Cardiff,Suva,Majuro,Yaren,Pevek,Petropavlovsk-Kamchatsky,Ouagadougou,Funafuti,Wake_Island,Yamoussoukro,Torshavn,Tórshavn,Banjul,Accra,Conakry,|GMT-1,Tirana,Luanda,Porto_Novo,Sarajevo,Yaounde,Yaoundé,Bangui,N'Djamena,Brazzaville,Kinshasa,Zagreb,Copenhagen,Malabo,Libreville,Frankfurt,Luxembourg,Vaduz,Valletta,Monaco,Podgorica,Casablanca*,Rabat*,Amsterdam,Niamey,Abuja,Skopje,Longyearbyen,Oslo,Tromso,Bratislava,Ljubljana,Barcelona,Stockholm,Bern,Zurich,Zürich,Vatican_City,El_Aaiun*,El_Aaiún*,|GMT-2,Tel_Aviv,Gaborone,Benghazi,Bujumbura,Gitega,Lubumbashi,Mbabane,Kemi,Rovaniemi,Maseru,Lilongwe,Kigali,Cape_Town,Pretoria,Dnipro,Lusaka,Harare,|GMT-3,Dar_es_Salaam,|GMT-4,Port_Louis,Muscat,Saint-Denis,Izhevsk,Seychelles,Victoria,Abu_Dhabi,|GMT-5,Port-aux-Francais,Amsterdam_Island,Astana,Male,Islamabad,Lahore,|GMT-5:30,New_Delhi,Bengaluru,Mumbai,Bombay,Chennai,Kolkata,Calcutta,Sri_Jayawardenepura_Kotte,|GMT-5:45,Kathmandu,|GMT-6,Diego_Garcia,|GMT-6:30,Naypyidaw,|GMT-6:30,Yangon,|GMT-7,Phnom_Penh,Vientiane,Khatanga,Norilsk,Hanoi,|GMT-8,Bandar_Seri_Begawan,Beijing,Chongqing,Lhasa,Urumqi,Ürümqi,Denpasar,Nusantara,Kuala_Lumpur,|GMT-8:45,Eucla,|GMT-9,Manokwari,Ngerulmud,Tiksi,|GMT-9:30,Alice_Springs,Darwin,|GMT-10,Cairns,Hagatna,Hagåtña,Komsomolsk-on-Amur,Verkhoyansk,|GMT-10:30,Adelaide*,|GMT-11,Canberra*,Sydney*,Hobart*,Melbourne*,Palikir,Yuzhno-Sakhalinsk,Honiara,Port_Vila,|GMT-12,Wake_Island,|GMT+1,Praia,Ponta_Delgada,|GMT+2,Ittoqqortoormiit,Kangerlussuaq,Qaanaaq,King_Edward_Point,|GMT+3,Cordoba,Córdoba,Brasilia,Belem,Belém,Rio_de_Janeiro,Punta_Arenas*,Santiago*,|GMT+3:30,Mary's_Harbour,St_John's,St_Johns,|GMT+4,Bridgetown,Hamilton,Sucre,Happy_Valley-Thule_Air_Base,Basse-Terre,Georgetown,Port_of_Spain,|GMT+5,Nassau,Alert,Coral_Harbour,Eureka,Grise_Fiord,Pond_Inlet,Ottawa,Chibougamau,Kuujjuaq,Montreal,Montréal,Easter_Island*,Quito,Kingston,Cancun,Cancún,|GMT+6,Belmopan,Baker_Lake,Resolute_Bay,San_Jose,Galapagos_Islands,San_Salvador,Guatemala_City,|GMT+7,Calgary,|GMT+8,Adamstown,|GMT+9,Fairbanks,Unalaska,|GMT+10,Papeete,|GMT+11,Dodoma,Alofi,Ankara,Midway,Kampala,Sana,Manama,Moroni,Djibouti,Asmara,Addis_Ababa,Kuwait_City,Antananarivo,Doha,Belushya_Guba,Mogadishu,Marion_Island_(Prince_Edward_Islands),Marion_Island,|GMT+12,Baker_Island," $aSubst = StringSplit($sSubst, "|") For $i = 1 To $aSubst[0] If StringInStr($aSubst[$i], ("," & $sWhere)) Then If StringInStr($aSubst[$i], ("," & $sWhere & "*")) Then $sWhere &= "*" $bPossDST = 1 EndIf If StringInStr($aSubst[$i], ("," & $sWhere & ",")) Then $sWhere = _ StringLeft($aSubst[$i], StringInStr($aSubst[$i], ",") - 1) If StringInStr($sWhere, "GMT") = 1 Then $sWhere = "Etc/" & $sWhere EndIf Next ; Fractional UTC/GMT offsets If StringInStr($sWhere, ":") Then $aFrac = StringSplit($sWhere, ":") $sWhere = $aFrac[1] $iIncr = $aFrac[2] If StringInStr($sWhere, "+") Then $iIncr *= -1 EndIf $sTZdata = "Africa/Abidjan,Africa/Algiers,Africa/Bissau,Africa/Cairo,Africa/Casablanca,Africa/Ceuta,Africa/El_Aaiun,Africa/Johannesburg,Africa/Juba,Africa/Khartoum,Africa/Lagos,Africa/Maputo,Africa/Monrovia,Africa/Nairobi,Africa/Ndjamena,Africa/Sao_Tome,Africa/Tripoli,Africa/Tunis,Africa/Windhoek,America/Adak,America/Anchorage,America/Araguaina,America/Argentina/Buenos_Aires,America/Argentina/Catamarca,America/Argentina/Cordoba,America/Argentina/Jujuy,America/Argentina/La_Rioja,America/Argentina/Mendoza,America/Argentina/Rio_Gallegos,America/Argentina/Salta,America/Argentina/San_Juan,America/Argentina/San_Luis,America/Argentina/Tucuman,America/Argentina/Ushuaia,America/Asuncion,America/Bahia,America/Bahia_Banderas,America/Barbados,America/Belem,America/Belize,America/Boa_Vista,America/Bogota,America/Boise,America/Cambridge_Bay,America/Campo_Grande,America/Cancun,America/Caracas,America/Cayenne,America/Chicago,America/Chihuahua,America/Ciudad_Juarez,America/Costa_Rica,America/Cuiaba,America/Danmarkshavn,America/Dawson,America/Dawson_Creek,America/Denver,America/Detroit,America/Edmonton,America/Eirunepe,America/El_Salvador,America/Fort_Nelson,America/Fortaleza,America/Glace_Bay,America/Goose_Bay,America/Grand_Turk,America/Guatemala,America/Guayaquil,America/Guyana,America/Halifax,America/Havana,America/Hermosillo,America/Indiana/Indianapolis,America/Indiana/Knox,America/Indiana/Marengo,America/Indiana/Petersburg,America/Indiana/Tell_City,America/Indiana/Vevay,America/Indiana/Vincennes,America/Indiana/Winamac,America/Inuvik,America/Iqaluit,America/Jamaica,America/Juneau,America/Kentucky/Louisville,America/Kentucky/Monticello,America/La_Paz,America/Lima,America/Los_Angeles,America/Maceio,America/Managua,America/Manaus,America/Martinique,America/Matamoros,America/Mazatlan,America/Menominee,America/Merida,America/Metlakatla,America/Mexico_City,America/Miquelon,America/Moncton,America/Monterrey,America/Montevideo,America/New_York,America/Nome,America/Noronha,America/North_Dakota/Beulah,America/North_Dakota/Center,America/North_Dakota/New_Salem,America/Nuuk,America/Ojinaga,America/Panama,America/Paramaribo,America/Phoenix,America/Port-au-Prince,America/Porto_Velho,America/Puerto_Rico,America/Punta_Arenas,America/Rankin_Inlet,America/Recife,America/Regina,America/Resolute,America/Rio_Branco,America/Santarem,America/Santiago,America/Santo_Domingo,America/Sao_Paulo,America/Scoresbysund,America/Sitka,America/St_Johns,America/Swift_Current,America/Tegucigalpa,America/Thule," $sTZdata &= "America/Tijuana,America/Toronto,America/Vancouver,America/Whitehorse,America/Winnipeg,America/Yakutat,Antarctica/Casey,Antarctica/Davis,Antarctica/Macquarie,Antarctica/Mawson,Antarctica/Palmer,Antarctica/Rothera,Antarctica/Troll,Antarctica/Vostok,Asia/Almaty,Asia/Amman,Asia/Anadyr,Asia/Aqtau,Asia/Aqtobe,Asia/Ashgabat,Asia/Atyrau,Asia/Baghdad,Asia/Baku,Asia/Bangkok,Asia/Barnaul,Asia/Beirut,Asia/Bishkek,Asia/Chita,Asia/Choibalsan,Asia/Colombo,Asia/Damascus,Asia/Dhaka,Asia/Dili,Asia/Dubai,Asia/Dushanbe,Asia/Famagusta,Asia/Gaza,Asia/Hebron,Asia/Ho_Chi_Minh,Asia/Hong_Kong,Asia/Hovd,Asia/Irkutsk,Asia/Jakarta,Asia/Jayapura,Asia/Jerusalem,Asia/Kabul,Asia/Kamchatka,Asia/Karachi,Asia/Kathmandu,Asia/Khandyga,Asia/Kolkata,Asia/Krasnoyarsk,Asia/Kuching,Asia/Macau,Asia/Magadan,Asia/Makassar,Asia/Manila,Asia/Nicosia,Asia/Novokuznetsk,Asia/Novosibirsk,Asia/Omsk,Asia/Oral,Asia/Pontianak,Asia/Pyongyang,Asia/Qatar,Asia/Qostanay,Asia/Qyzylorda,Asia/Riyadh,Asia/Sakhalin,Asia/Samarkand,Asia/Seoul,Asia/Shanghai,Asia/Singapore,Asia/Srednekolymsk,Asia/Taipei,Asia/Tashkent,Asia/Tbilisi,Asia/Tehran,Asia/Thimphu,Asia/Tokyo,Asia/Tomsk,Asia/Ulaanbaatar,Asia/Urumqi,Asia/Ust-Nera,Asia/Vladivostok,Asia/Yakutsk,Asia/Yangon,Asia/Yekaterinburg,Asia/Yerevan,Atlantic/Azores,Atlantic/Bermuda,Atlantic/Canary,Atlantic/Cape_Verde,Atlantic/Faroe,Atlantic/Madeira,Atlantic/South_Georgia,Atlantic/Stanley,Australia/Adelaide,Australia/Brisbane,Australia/Broken_Hill,Australia/Darwin,Australia/Eucla,Australia/Hobart,Australia/Lindeman,Australia/Lord_Howe,Australia/Melbourne,Australia/Perth,Australia/Sydney,CET,CST6CDT,EET,EST,EST5EDT,Etc/GMT,Etc/GMT+1,Etc/GMT+10,Etc/GMT+11,Etc/GMT+12,Etc/GMT+2,Etc/GMT+3,Etc/GMT+4,Etc/GMT+5,Etc/GMT+6,Etc/GMT+7,Etc/GMT+8,Etc/GMT+9,Etc/GMT-1,Etc/GMT-10,Etc/GMT-11,Etc/GMT-12,Etc/GMT-13,Etc/GMT-14,Etc/GMT-2,Etc/GMT-3,Etc/GMT-4,Etc/GMT-5,Etc/GMT-6,Etc/GMT-7,Etc/GMT-8,Etc/GMT-9,Etc/UTC,Europe/Andorra,Europe/Astrakhan,Europe/Athens,Europe/Belgrade,Europe/Berlin,Europe/Brussels,Europe/Bucharest,Europe/Budapest,Europe/Chisinau,Europe/Dublin,Europe/Gibraltar,Europe/Helsinki,Europe/Istanbul,Europe/Kaliningrad,Europe/Kirov,Europe/Kyiv,Europe/Lisbon,Europe/London,Europe/Madrid,Europe/Malta,Europe/Minsk,Europe/Moscow,Europe/Paris,Europe/Prague,Europe/Riga,Europe/Rome,Europe/Samara,Europe/Saratov,Europe/Simferopol,Europe/Sofia,Europe/Tallinn,Europe/Tirane,Europe/Ulyanovsk,Europe/Vienna,Europe/Vilnius,Europe/Volgograd,Europe/Warsaw,Europe/Zurich,HST,Indian/Chagos,Indian/Maldives,Indian/Mauritius,MET,MST,MST7MDT,PST8PDT,Pacific/Apia,Pacific/Auckland,Pacific/Bougainville,Pacific/Chatham,Pacific/Easter,Pacific/Efate,Pacific/Fakaofo,Pacific/Fiji,Pacific/Galapagos,Pacific/Gambier,Pacific/Guadalcanal,Pacific/Guam,Pacific/Honolulu,Pacific/Kanton,Pacific/Kiritimati,Pacific/Kosrae,Pacific/Kwajalein,Pacific/Marquesas,Pacific/Nauru,Pacific/Niue,Pacific/Norfolk,Pacific/Noumea,Pacific/Pago_Pago,Pacific/Palau,Pacific/Pitcairn,Pacific/Port_Moresby,Pacific/Rarotonga,Pacific/Tahiti,Pacific/Tarawa,Pacific/Tongatapu,WET," $sSubst = StringReplace($sSubst, "_", " ") $sSubst = StringReplace($sSubst, "*", "") $sTZdata &= $sSubst $aTZdata = StringSplit($sTZdata, ",") $iMatch = _ListMatches($sWhere) If Not $iMatch Then If Not $sOut Then $sOut = "Nothing on """ & $sWhere & """" Exit ConsoleWrite($sOut) EndIf $sTail = $aTZdata[$iMatch] $sURL &= $sTail $h1 = InetGet($sURL, $sDataFn) If Not $h1 Then If Not $sOut Then _ExitError("Nothing on """ & $sWhere & """") Else Exit ConsoleWrite($sOut & @CRLF) EndIf EndIf InetClose($h1) $h2 = FileOpen($sDataFn) If $h2 < 0 Then _ExitError("Error opening " & $sDataFn) $sData = FileRead($h2) FileClose($h2) If FileExists($sDataFn) Then FileDelete($sDataFn) $aData = StringSplit($sData, ",") $sDoW = "Mon|Tue|Wed|Thu|Fri|Sat|Sun" $aDow = StringSplit($sDoW, "|") If $iIncr = 0 Then $iDoW0 = @WDAY - 1 If $iDoW0 < 1 Then $iDow0 = 7 $iDoW1 = StringRight($aData[3], 1) $sOut &= $aDoW[$iDow1] & " " $sOut &= StringMid($aData[5], 24, 8) If $aData[10] = '"dst":true' Then $sOut &= " (DST)" Else $DTime = StringReplace(StringMid($aData[5], 13, 19), "-", "/") $DTime = StringReplace($DTime, "T", " ") $DTadj = _DateAdd("n", $iIncr, $DTime) $aDTm = StringSplit(StringLeft($DTadj, 10), "/") $iDow1 = _DateToDayofWeek($aDTm[1], $aDTm[2], $aDTm[3]) - 1 If $iDoW1 < 1 Then $iDow1 = 7 $sOut &= $aDoW[$iDoW1] & " " & StringRight($DTadj, 8) EndIf If $bPossDST Then $sOut &= @CRLF & "(possibly plus|minus DST offset)" Exit ConsoleWrite($sOut & @CRLF) Func _ListMatches($sStr = "") Local $iCount = 0, $iIndex = 0, $sFixGMT = "", $sStr0 = "" If $sStr Then For $i = 1 To $aTZdata[0] If StringInStr($aTZdata[$i], $sStr) = 0 Or _ StringInStr($aTZdata[$i], "|") = 1 Then ContinueLoop $iIndex = $i $sStr0 = $aTZdata[$i] If StringInStr($sStr0, "/") And Not StringInStr($sStr0, "Etc/") Then $sStr0 = StringSplit($sStr0, "/")[2] If $sStr0 = $sStr Then $sFixGMT = $aTZdata[$i] If StringInStr($sFixGMT, "Etc/") = 1 Then $sFixGMT = StringReplace($aTZdata[$i], "Etc/GMT", "UTC/GMT") If StringInStr($sFixGMT, "+") = 8 Then $sFixGMT = StringReplace($sFixGMT, "+", "-") ElseIf StringInStr($sFixGMT, "-") = 8 Then $sFixGMT = StringReplace($sFixGMT, "-", "+") EndIf EndIf If $iIncr > 0 Then $sFixGMT &= ":" & String(Abs($iIncr)) $sOut &= $sFixGMT & " " Return $iIndex EndIf $iCount += 1 If $iCount = 2 Then $sOut &= @CRLF If StringInStr($aTZdata[$i], "Etc/") = 0 Then $sOut &= $aTZdata[$i] & " " If $iCount > 1 Then $sOut &= @CRLF EndIf Next EndIf If Not $iCount Then _ExitError("Nothing on """ & $sStr & """") Else If $iCount > 1 Then $iCount = 0 Else $iCount = $iIndex EndIf EndIf Return $iCount EndFunc ;==>_ListMatches Func _ExitError($sStr = "") If $sStr Then ConsoleWrite($sStr & @CRLF) Exit EndFunc ;==>_ExitError Func _ShowHelp() ConsoleWrite("World Time via WorldTimeAPI " & $sRevDate & _ @CRLF & "Supplemental time zone data from www.timeanddate.com" & _ @CRLF & "Usage:" & @CRLF & StringTrimRight(@ScriptName, 4) & _ " <CITY>" & @CRLF & "--" & @CRLF & StringTrimRight(@ScriptName, 4) & _ " <substring> lists cities in database containing <substring>" & _ @CRLF & "Listings in format <continent>/<city> (e.g., Europe/Lisbon) obtain" & _ @CRLF & " the current time from the server at worldtimeapi.org." & @CRLF & _ "Listings with city name only use an internal database to determine" & _ @CRLF & " the applicable UTC/GMT offset." & @CRLF & _ "Accuracy is NOT guaranteed!" & @CRLF) EndFunc ;==>_ShowHelp ...so, who wrote this @CarlD ? Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
CarlD Posted December 21, 2024 Author Posted December 21, 2024 10 minutes ago, argumentum said: ...so, who wrote this @CarlD ? I did, of course. I also/often go by my initials, CLD. argumentum 1
CarlD Posted December 22, 2024 Author Posted December 22, 2024 (edited) Thanks to suggestions from @argumentum, I will be revising this script -- but not until after the year-end holidays. Cheers. Edited December 22, 2024 by CarlD argumentum 1
jchd Posted December 22, 2024 Posted December 22, 2024 From the mid 70's the Acronym GMT doesn't have any precise scientific definition. Use UTC instead, including leap seconds! This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
CarlD Posted December 26, 2024 Author Posted December 26, 2024 On 12/22/2024 at 6:44 AM, jchd said: From the mid 70's the Acronym GMT doesn't have any precise scientific definition. Use UTC instead, including leap seconds! Well, the IANA time zones listed by the server uses UTC and GMT interchangeably. See https://timeapi.io/api/timezone/availabletimezones. So the script follows the IANA naming scheme. As for leap seconds, not sure if the time server makes that adjustment, but all I'm doing here is grabbing the time from the server. It is what it is.
jchd Posted December 26, 2024 Posted December 26, 2024 For a more or less detailed history of timescales, see https://www.ucolick.org/~sla/leapsecs/timescales.html About timezones, rules, regions are changing so fast theat it's impossible in practice to be correct in the general case. Just for recent years: https://time.is/fr/time_zone_news CarlD 1 This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
argumentum Posted December 26, 2024 Posted December 26, 2024 If $CmdLine[0] Then $sWhere = $CmdLineRaw If StringInStr($sWhere, @ScriptFullPath) Then $sWhere = StringStripWS(StringTrimLeft($sWhere, StringInStr($sWhere, @ScriptFullPath) + StringLen(@ScriptFullPath)), 3) ConsoleWrite('>' & $sWhere & '<' & @CRLF) Looks good. 👍 CarlD 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
CarlD Posted December 28, 2024 Author Posted December 28, 2024 On 12/26/2024 at 2:01 PM, argumentum said: If $CmdLine[0] Then $sWhere = $CmdLineRaw If StringInStr($sWhere, @ScriptFullPath) Then $sWhere = StringStripWS(StringTrimLeft($sWhere, StringInStr($sWhere, @ScriptFullPath) + StringLen(@ScriptFullPath)), 3) ConsoleWrite('>' & $sWhere & '<' & @CRLF) Looks good. 👍 Thanks. I'm sure you're trying to tell me something with that code snippet, but unfortunately it's going over my head.
CarlD Posted December 28, 2024 Author Posted December 28, 2024 (edited) On 12/26/2024 at 1:36 PM, jchd said: For a more or less detailed history of timescales, see https://www.ucolick.org/~sla/leapsecs/timescales.html About timezones, rules, regions are changing so fast theat it's impossible in practice to be correct in the general case. Just for recent years: https://time.is/fr/time_zone_news Thanks for these links. I know that time zones change all the time. My script will only be as accurate as the time server's output. Except for the additional cities in the substitution table ($sSubst), where the UTC offset can change without notice. Oh well. Time.is is a great site. I only wish they had an API that would simply report the time in those 7 million cities. Edited December 28, 2024 by CarlD
argumentum Posted December 28, 2024 Posted December 28, 2024 28 minutes ago, CarlD said: I'm sure you're trying to tell me something Yes I am. Just add that line to your script. It will not brake anything and will allow to press Shift-F8 in SciTE, and add the command line. Allowing to test from the comfort of SciTE without touching the script CarlD 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
CarlD Posted December 28, 2024 Author Posted December 28, 2024 3 hours ago, argumentum said: Yes I am. Just add that line to your script. It will not brake anything and will allow to press Shift-F8 in SciTE, and add the command line. Allowing to test from the comfort of SciTE without touching the script Oh, that's great! I always wondered how to do that and never took the time to find it in the documentation. Many thanks! argumentum 1
jchd Posted December 28, 2024 Posted December 28, 2024 11 hours ago, CarlD said: Thanks for these links. I know that time zones change all the time. True. The only way to get rid of all these unsolvable TZ+DST issues would be to use only UTC everywhere for all purposes. Of course it would need that almost all humans change their "clock" habits, and accept that their "normal" wake up time is no more e.g. 06:30 but 01:00 or 17:45 depending on where they are. CarlD 1 This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
CarlD Posted December 28, 2024 Author Posted December 28, 2024 (edited) 10 hours ago, jchd said: True. The only way to get rid of all these unsolvable TZ+DST issues would be to use only UTC everywhere for all purposes. Of course it would need that almost all humans change their "clock" habits, and accept that their "normal" wake up time is no more e.g. 06:30 but 01:00 or 17:45 depending on where they are. It's an interesting thought experiment. I think sundials would become popular again. Edited December 28, 2024 by CarlD
argumentum Posted December 28, 2024 Posted December 28, 2024 (edited) ..the Hippocratic oath. The same that said "A physician without knowledge of astrology has no right to call himself a physician.". ( if memory serves. Long time ago ) ..the Jewish had a strong dispute ( if not brake away ) about being a Moon follower vs. a Sun follower. ( thousands of years ago but I don't remember clearly. It was thousands of years ago ) Yes, daylight savings time will save us from .. something. Yet there are records that show that in average more people die of a heart attack the following day Maybe we should all live by the sundial. It'd be a pain to organize a game online but, ..if we needed guns to defend from wild animals like in the days of the far/wild west, a high noon bang-bang may not occur in time. To this day countries are moving time to a side or the other. 1 hour ago, CarlD said: It's an interesting thought experiment. I think sundials would become popular again. ..yes, I agree. I have eyes on a pocket sundial that I like 🤪 Spoiler hmmm, .. I think this goes in chat 🤦♂️ Edited December 28, 2024 by argumentum words don't follow my thinking =( CarlD 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now