Post

Script convert time follow timezones

Goal

Sometimes I have stuffs in operation activities like:

  • Announcement times in change deployment
  • Give colleagues the time for specific purposes.

However we work at Global Team with people across some countries in the world. The best way that convert time to UTC. But I still want to give more detailed about our Global Timezone team members when provide information time.

Therefore I code this simple shell script to work as local laptop tool to do it.

Installation

How to list current local Kubernetes contexts ?

1
2
3
4
$ git clone https://github.com/Amagez/convert-tzs.git
$ cd convert-tzs
$ chmod +x ctz.sh
$ mv ctz.sh /usr/local/bin/ctz

Usage

You may need to update list of wished timezones in script.

1
2
$ vi /usr/local/bin/ctz
timezones=('Asia/Ho_Chi_Minh' 'Asia/Shanghai' 'Europe/Moscow' 'EST')

When you execute, please input time as 24 hours standard convention.

1
2
$ ctz 2030
Oct 09 13:30 UTC | Oct 09 20:30 VNZ | Oct 09 21:30 CST | Oct 09 16:30 MSK

It also supports only one string now or empty agrument will be now input.

1
2
3
4
5
$ ctz now
Oct 08 18:09 UTC | Oct 09 01:09 VNZ | Oct 09 02:09 CST | Oct 08 21:09 MSK

$ ctz
Oct 08 18:09 UTC | Oct 09 01:09 VNZ | Oct 09 02:09 CST | Oct 08 21:09 MSK

Open source tools