Both use http://www.timeanddate.com, which uses TLS 1.2. If you're receiving an error from urlDownloadToVar(), see this page.
Examples:
Code: Select all
country:="Canada"
region:="Ontario"
timezone:="IST"
cTime:=getCurrentTime(country,region)
if(!cTime)
msgbox,,Error,Area not found
else
msgbox,,Time,% "Current time in " . (region?region . ", ":"") . country . ":`n`n" . cTime.hour . ":" . cTime.minute . cTime.ampm . ", " . cTime.date
tTime:=getCurrentTime(timezone,,1)
if(!tTime)
msgbox,,Error,Timezone not found
else
msgbox,,Time,% "Current time in " . timezone . ":`n`n" . tTime.hour . ":" . tTime.minute . tTime.ampm . ", " . tTime.date
exitApp
Code: Select all
timezone:="IST"
UTCOffset:=getUTCOffset(timezone)
if(!UTCOffset)
msgbox,,Error,Timezone not found
else
msgbox,,UTC Offset,% "Offset for " . timezone . ": " . UTCOffset.sign . UTCOffset.hour . ":" . UTCOffset.minute
exitApp
Code: Select all
timezone:="EDT"
UTCO:=getUTCOffset(timezone)
if(!UTCO)
msgbox,,Error,Timezone not found
else
setTimer,activeClock,100
return
activeClock:
cStamp:=a_nowUTC
if(UTCO.sign="+")
cStamp+=UTCO.hour * 10000 + UTCO.minute * 100
else if(UTCO.sign="-")
cStamp-=UTCO.hour * 10000 + UTCO.minute * 100
else{
setTimer,activeClock,off
msgbox,,Error,Sign could not be retrieved
}
formatTime,timezoneCTime,% cStamp,h:mmtt
tool(timezone . ": " . timezoneCTime)
return
esc::exitApp