tz

Timezone converter tag by P-CH.#4795

Privateunrated

Content

23 lines
{=(localTime):{any({in(am):{lower:{args(1)}}}==true|{in(pm):{lower:{args(1)}}}==true):{replace(24,12):{replace(12,0):{if({in(am):{lower:{args(1)}}}==true):{replace(am,):{args(1)}}|{m:trunc({replace(pm,):{args(1)}}+12)}}}}|{args(1)}}}
{=(remoteTime):{any({in(am):{lower:{args(3)}}}==true|{in(pm):{lower:{args(3)}}}==true):{replace(24,12):{replace(12,0):{if({in(am):{lower:{args(3)}}}==true):{replace(am,):{args(3)}}|{m:trunc({replace(pm,):{args(3)}}+12)}}}}|{args(3)}}}
{=(zonesS):GMT~BST~CEST~EEST~MSD~.~.~.~.~.~.~ADT~EDT~CDT~MDT~PDT}
{=(zonesW):GMT~CET~EET~MSK~.~.~.~.~.~.~.~AST~EST~CST~MST~PST}
{=(zones):{and({strf:%m%d}>=0329|{strf:%m%d}<=1030):{replace(~, ):{zonesS}}|{replace(~, ):{zonesW}}}}
{=(offset):0~1~2~3~4~5~6~7~8~9~-2~-3~-4~-5~-6~-7}
{=(check):{and({localTime}>=0|{localTime}<=23|{remoteTime}>=0|{remoteTime}<=23|{in({upper:{args(2)}}):{replace(~, ):{zones}}}==true|{args(2)}!=.):+|-}}
{=(output):{m:trunc({remoteTime}-{list({index({upper:{args(2)}}):{zones}}):{offset}}+{m:trunc({localTime}-{strf:%H})})}}
{=(outputLimited):{any({output}>24|{output}<0):{if({output}>24):{m:trunc({output}-24)}|{m:trunc({output}+24)}}|{output}}}
{embed(title):.tz --- Timezone Converter}
{embed(color):#b38844}
{embed(description):{if({args(1)}==help):Syntax: ``.tz <localTime> <convertFromZone> <convertFromTime>``

localTime: your current time
convertFromZone: timezone abbreviaton of the time you want to convert from
convertFromTime: the time mentioned along the timezone you want to convert from
Example: ``.tz 13 GMT 10``
--> your local time is 13 (or 1pm), you want to convert the GMT time 10 (10am) to your timezone's time equivalent

Please note that you have use the correct timezone abbreviations! If you put in a summer timezone even tho its winter (or vice versa), the tag wont work properly.
Also, the tag only works with full hours.
You can find all timezone abbreviations that can be used [here](https://docs.google.com/spreadsheets/d/1G5AwXDRrLDE9lW12pScMu0PaYeiXrjCMKx0QpqTYOEo/edit?usp=sharing ".tz information spreadsheet")}
{if({check}==+):{args(3)} {upper:{args(2)}} is going to be at {replace(0am,12am):{replace(0pm,12pm):{any({in(am):{lower:{args(1)}}}==true|{in(pm):{lower:{args(1)}}}==true):{if({outputLimited}<=11):{outputLimited}am|{m:trunc({outputLimited}-12)}pm}|{outputLimited}}}} your time ({list({index({m:trunc({localTime}-{strf:%H})}):{replace(~, ):{offset}}}):{replace( ,~):{zones}}}).|{if({args(1)}!=help):Please run ``.tz help`` for help.}}}

Embed

1 line
{"color": 5198940, "description": " "}
Raw JSON
{
  "id": 972578,
  "created_at": "2021-07-27T17:30:30.000Z",
  "tag_name": "tz",
  "nsfw": false,
  "owner_id": "668153818810286092",
  "uses": 140,
  "description": "Timezone converter tag by P-CH.#4795",
  "restricted": false,
  "shared": false,
  "deleted": false,
  "safe": "unrated",
  "hidden": false,
  "guild_id": "290355781344428033",
  "sharer": "668153818810286092",
  "content": "{=(localTime):{any({in(am):{lower:{args(1)}}}==true|{in(pm):{lower:{args(1)}}}==true):{replace(24,12):{replace(12,0):{if({in(am):{lower:{args(1)}}}==true):{replace(am,):{args(1)}}|{m:trunc({replace(pm,):{args(1)}}+12)}}}}|{args(1)}}}\n{=(remoteTime):{any({in(am):{lower:{args(3)}}}==true|{in(pm):{lower:{args(3)}}}==true):{replace(24,12):{replace(12,0):{if({in(am):{lower:{args(3)}}}==true):{replace(am,):{args(3)}}|{m:trunc({replace(pm,):{args(3)}}+12)}}}}|{args(3)}}}\n{=(zonesS):GMT~BST~CEST~EEST~MSD~.~.~.~.~.~.~ADT~EDT~CDT~MDT~PDT}\n{=(zonesW):GMT~CET~EET~MSK~.~.~.~.~.~.~.~AST~EST~CST~MST~PST}\n{=(zones):{and({strf:%m%d}>=0329|{strf:%m%d}<=1030):{replace(~, ):{zonesS}}|{replace(~, ):{zonesW}}}}\n{=(offset):0~1~2~3~4~5~6~7~8~9~-2~-3~-4~-5~-6~-7}\n{=(check):{and({localTime}>=0|{localTime}<=23|{remoteTime}>=0|{remoteTime}<=23|{in({upper:{args(2)}}):{replace(~, ):{zones}}}==true|{args(2)}!=.):+|-}}\n{=(output):{m:trunc({remoteTime}-{list({index({upper:{args(2)}}):{zones}}):{offset}}+{m:trunc({localTime}-{strf:%H})})}}\n{=(outputLimited):{any({output}>24|{output}<0):{if({output}>24):{m:trunc({output}-24)}|{m:trunc({output}+24)}}|{output}}}\n{embed(title):.tz --- Timezone Converter}\n{embed(color):#b38844}\n{embed(description):{if({args(1)}==help):Syntax: ``.tz <localTime> <convertFromZone> <convertFromTime>``\n\nlocalTime: your current time\nconvertFromZone: timezone abbreviaton of the time you want to convert from\nconvertFromTime: the time mentioned along the timezone you want to convert from\nExample: ``.tz 13 GMT 10``\n--> your local time is 13 (or 1pm), you want to convert the GMT time 10 (10am) to your timezone's time equivalent\n\nPlease note that you have use the correct timezone abbreviations! If you put in a summer timezone even tho its winter (or vice versa), the tag wont work properly.\nAlso, the tag only works with full hours.\nYou can find all timezone abbreviations that can be used [here](https://docs.google.com/spreadsheets/d/1G5AwXDRrLDE9lW12pScMu0PaYeiXrjCMKx0QpqTYOEo/edit?usp=sharing \".tz information spreadsheet\")}\n{if({check}==+):{args(3)} {upper:{args(2)}} is going to be at {replace(0am,12am):{replace(0pm,12pm):{any({in(am):{lower:{args(1)}}}==true|{in(pm):{lower:{args(1)}}}==true):{if({outputLimited}<=11):{outputLimited}am|{m:trunc({outputLimited}-12)}pm}|{outputLimited}}}} your time ({list({index({m:trunc({localTime}-{strf:%H})}):{replace(~, ):{offset}}}):{replace( ,~):{zones}}}).|{if({args(1)}!=help):Please run ``.tz help`` for help.}}}",
  "embed": "{\"color\": 5198940, \"description\": \" \"}",
  "last_fetched": "2026-10-20T17:12:31.517Z"
}