Skip to content

Instantly share code, notes, and snippets.

@akiyoshi83
Created July 22, 2021 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akiyoshi83/11130d8290af121c14ba37d3974cd0db to your computer and use it in GitHub Desktop.
Save akiyoshi83/11130d8290af121c14ba37d3974cd0db to your computer and use it in GitHub Desktop.
Show time by multiple timezone.
# Example:
# $ tzconv
# 2021-07-22 13:19:25 UTC
# 2021-07-22 22:19:25 JST
# 2021-07-22 06:19:25 PDT
# 2021-07-22 14:19:25 BST
#
# $ tzconv "2021-01-01 00:00 JST"
# 2020-12-31 15:00:00 UTC
# 2021-01-01 00:00:00 JST
# 2020-12-31 07:00:00 PST
# 2020-12-31 15:00:00 GMT
tzs=$(cat <<EOS
UTC
Asia/Tokyo
America/Los_Angeles
Europe/London
EOS
)
for tz in $tzs
do
if [ -z "$1" ]; then
TZ=$tz date "+%Y-%m-%d %H:%M:%S %Z"
else
TZ=$tz date --date "$1" "+%Y-%m-%d %H:%M:%S %Z"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment