I originally created this for my bot, so people could store their local timezones into the bot, and it would remember them for future references in case someone wanted to find out the current time for that particular person if they weren't online.
The snippet supports the following timezones:
ACDT ACST ADT AEDT AEST AHST AKDT AKST AST AT AWDT AWST BST BT CAT CCT CDT CEDT CEST
CET CST CXT DST EEDT EEST EET EST GMT GST HST IDLE IDLW IST JST MDT MSD MSK MST NDT
NFT NST NT NZST PDT PST UT UTC WAT WEDT WEST WET WST YST
It's my first attempt at a timezone snippet, so be gentle! ;)
Usage: /tzone <#channel> --- #channel is optional, will echo if left out.
or, in the bot as: on :TEXT:!tzone:#:tzone $2 $chan
A few examples (without channel):
/tzone CST+0.25
CST+0.25 [Central Standard Time] 00:55 @ Wed 20th May [GMT -5.75]
/tzone GMT+8
GMT+8 [Greenwich Mean Time] 14:40 @ Wed 20th May
/tzone JST
JST [Japan Standard Time] 15:45 @ Wed 20th May [GMT +9]
/tzone ACST-1
ACST-1 [Australia Central Standard Time] 15:20 @ Wed 20th May [GMT +8.5]
/tzone +9
GMT+9 [Greenwich Mean Time] 16:44 @ Wed 20th May
/tzone noidea
Unknown Timezone Format - Defaulting to GMT..
GMT [Greenwich Mean Time] 07:31 @ Wed 20th May
alias tzone {
var %w = -12&-11&-10&-10&-10&-9&-9&-8&-8&-7&-7&-6&-6&-5&-5&-4&-3.5&-3&-2.5&-2&-1&+12&+12&11.5&+11&+10.5&+10&+10&+9.5&+9&+9&+8&+8+8&&+7&+4&+3&+3&+3&+3&+2&+2&+2&+1&+1&+1&+1&+1&+1&0&0&0&0
var %x = IDLW NT HST CAT AHST YST AKST PST AKDT PDT MST MDT CST EST CDT AST NST ADT NDT AT WAT IDLE NZST NFT AEDT ACDT AEST GST ACST AWDT JST AWST CCT WST CXT MSD MSK BT EEDT EEST EET CEDT CEST CET DST BST IST WEDT WEST WET UTC UT GMT
var %y = International Date Line West.Nome.Hawaii Standard.Central Alaska.Alaska-Hawaii Standard.Yukon Standard.Alaska Standard.Pacific Standard.Alaska Daylight.Pacific Daylight.Mountain Standard.Mountain Daylight.Central Standard.Eastern Standard.Central Daylight.Atlantic Standard.Newfoundland Standard.Atlantic Daylight.Newfoundland Daylight.Azores.West Africa.International Date Line East.New Zealand Standard.Norfolk Island.Australian Eastern Daylight.Australian Central Daylight.Australian Eastern Standard.Guam Standard.Australia Central Standard.Australian Western Daylight Time.Japan Standard.Australian Western Standard.China Coast.Western Standard.Christmas Island.Moscow Daylight.Moscow Standard.Baghdad.Eastern European Daylight.Eastern European Summer.Eastern European.Central European Daylight.Central European Summer.Central European.Daylight Saving.British Summer.Irish Summer.Western European Daylight.Western European Summer.Western European.Universal Co-ordinated.Universal.Greenwich Mean
if (!$istok(%x,$alpha($1),32)) { $iif(!$isin($left($1,1),+ -),.msg $2 Unknown Timezone Format - Defaulting to GMT..) | tokenize 32 $+(GMT,$iif($isin($left($1,1),+ -),$1,$+($v1,$gettok($1,2,$asc($v1))))) $2 }
var %zone = $gettok(%y,$findtok(%x,$alpha($1),1,32),46), %gmt = $iif($calc($gettok(%w,$findtok(%x,$alpha($1),1,32),38) $iif($isin($1,+ -),$v1 $gettok($1,2,$asc($v1)))) > -1,$+($chr(43),$v1),$v1)
var %time = $calc($gmt $left(%gmt,1) (($remove($gettok(%gmt,1,46),$chr(43),$chr(45)) * 60 * 60) + $iif($numtok(%gmt,46),$calc(60 * $+($chr(46),$gettok(%gmt,2,46)))) * 60)) )
$iif($2,.msg $2,echo -a) $1 $+($chr(91),$addtok(%zone,Time,32),$chr(93)) $asctime(%time,HH:nn) @ $asctime(%time,ddd ddoo mmm) $iif($alpha($1) != GMT,$+($chr(91),GMT %gmt,$chr(93)))
}
alias -l isin { var %n = $numtok($2-,32) | while (%n) { if ($gettok($2-,%n,32) isin $1) { return $v1 } | dec %n } }
alias -l alpha { var %a = $len($1), %b = 1, %z | while (%b <= %a) { var %v = $mid($1,%b,1) | if (%v !isalpha) { return %z } | var %z = $+(%z,$mid($1,%b,1)) | inc %b } | return $1 }
Doesn't include SAST (South Africa Standard Time)
added to include:
var %w = -12&-11&-10&-10&-10&-9&-9&-8&-8&-7&-7&-6&-6&-5&-5&-4&-3.5&-3&-2.5&-2&-1&+12&+12&11.5&+11&+10.5&+10&+10&+9.5&+9&+9&+8&+8+8&&+7&+4&+3&+3&+3&+3&+2&+2&+2&+2&+1&+1&+1&+1&+1&+1&+1&0&0&0&0
var %x = IDLW NT HST CAT AHST YST AKST PST AKDT PDT MST MDT CST EST CDT AST NST ADT NDT AT WAT IDLE NZ NZST NFT AEDT ACDT AEST GST ACST AWDT JST AWST CCT WST CXT MSD MSK BT EEDT EEST EET SAST CEDT CEST CET BEL DST BST IST WEDT WEST WET UTC UT GMT
var %y = International Date Line West.Nome.Hawaii Standard.Central Alaska.Alaska-Hawaii Standard.Yukon Standard.Alaska Standard.Pacific Standard.Alaska Daylight.Pacific Daylight.Mountain Standard.Mountain Daylight.Central Standard.Eastern Standard.Central Daylight.Atlantic Standard.Newfoundland Standard.Atlantic Daylight.Newfoundland Daylight.Azores.West Africa.International Date Line East.New Zealand.New Zealand Standard.Norfolk Island.Australian Eastern Daylight.Australian Central Daylight.Australian Eastern Standard.Guam Standard.Australia Central Standard.Australian Western Daylight Time.Japan Standard.Australian Western Standard.China Coast.Western Standard.Christmas Island.Moscow Daylight.Moscow Standard.Baghdad.Eastern European Daylight.Eastern European Summer.Eastern European.South Africa Standard.Central European Daylight.Central European Summer.Central European.Belgium.Daylight Saving.British Summer.Irish Summer.Western European Daylight.Western European Summer.Western European.Universal Co-ordinated.Universal.Greenwich Mean
Jethro_ thanks for answering those days had a problem with the server justin.tv I grab them and I can not put the bot on other channels you know anything about that? and the other question is how do I q the bot has an option for repeat q different answers on occasions such as: on 1: TEXT:! joke *: # (/ describe $ chan [bot] ► brut was so gross when the teacher erased the task in the l erased the blackboard in the notebook .. Q) but assuming you another joke as I do for q below the alternatives? ... Thanks and greetings:)