mIRC Homepage
Posted By: Nordy Certain Location Time Script? - 23/01/16 03:58 PM
Hello :-) Is there any way to add a specific time zone that shows what time it is somewhere? Like:

03:25 pm GMT

to

4:27 am SST

Code:
On *:text:!time:#:{
  msg # $time(hh:nn tt) ?timezone?
}


Thanks
Posted By: Dazuz Re: Certain Location Time Script? - 23/01/16 06:57 PM
I feel obligated to say that time zones are a pain in the ass, but yes that's definitely possible.

You can use $gmt identifier and then add/take hours from it as you please. As an example I live in Finland, and currently our offset is UTC+2. To get that out of the $gmt time, all I need to do is to add 2 hours (7200 seconds) to it:
Code:
$calc(7200+$gmt)

And then change it into whatever format I want:
Code:
$asctime($calc(7200+$gmt),yyyy-mm-dd HH:nn:ss zzz)

Which returns: 2016-01-23 20:53:49 +0200 GMT


EDIT: /help $asctime
Posted By: Nordy Re: Certain Location Time Script? - 23/01/16 08:46 PM
Awesome thanks alot for your help!
© mIRC Discussion Forums