Skip to content

Instantly share code, notes, and snippets.

@tk3369
Created July 10, 2021 08:05
Show Gist options
  • Save tk3369/7677a2ab21c0fa48036e3dd4166d18c2 to your computer and use it in GitHub Desktop.
Save tk3369/7677a2ab21c0fa48036e3dd4166d18c2 to your computer and use it in GitHub Desktop.
hojbot tz command
Improve tz command
- "tz me <my-time-zone>" command to configure per-user time zone
- "tz alias add <alias> <zone-name>" command to add system aliases
- "tz alias rm <alias>" command to remove system aliases
- target time zone command "tz <date> <time> <zone1> to <zone2>,<zone3>,..."
(without zone2+, it converts to user's own time zone, or direct user to use tz me command)
Reference: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
Examples:
> tz me America/Los_Angeles
@tk3369, your time zone preference is now America/Los_Angeles.
> tz me America/wat
@tk3369, sorry, time zone "America/wat" is not valid.
You can find a list of time zones at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
> tz alias list
@tk3369, time zone aliases are as follows:
- LA: America/Los_Angeles
- BRU: Europe/Brussels
> tz alias add NY America/New_York
@tk3369, time zone alias "NY" has been set to "America/New_York"
> tz alias rm NY
@tk3369, time zone alias "NY" has been removed.
> tz alias rm BMW
@tk3369, sorry, time zone alias "BMW" does not exist.
> tz 2021-03-21 03:00PM LA to NY
@tk3369, 2021-03-21 03:00PM LA = 2021-03-21 06:00PM NY
> tz 2021-03-21 03:00PM LA to BMW
@tk3369, sorry, time zone "BMW" does not exist.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment