Skip to content

Instantly share code, notes, and snippets.

@nicc777
Created July 23, 2023 09:08
Show Gist options
  • Save nicc777/731f5cce0055dd92cc756af10f518d42 to your computer and use it in GitHub Desktop.
Save nicc777/731f5cce0055dd92cc756af10f518d42 to your computer and use it in GitHub Desktop.
Command Line World Clock
#!/bin/sh
# Command-line world clock - source: https://stackoverflow.com/questions/370075/command-line-world-clock
: ${WORLDCLOCK_ZONES:=$HOME/world_time_zones}
: ${WORLDCLOCK_FORMAT:='+%Y-%m-%d %H:%M:%S %Z'}
while read zone
do echo $zone '!' $(TZ=$zone date "$WORLDCLOCK_FORMAT")
done < $WORLDCLOCK_ZONES |
awk -F '!' '{ printf "%-20s %s\n", $1, $2;}'
Europe/Amsterdam
Europe/London
Africa/Johannesburg
Pacific/Auckland
Australia/Brisbane
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment