Created
March 20, 2023 09:04
multiple timezone date-time display
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# example: | |
# sh ./datetime.sh | |
# Monday 2023/03/20 09:01 UTC (GMT: 09:01 +0000 PDT: 02:01 -0700 CET: 10:01 +0100 UTC: 09:01 +0000) | |
timeZones=("Europe/London America/Vancouver Europe/Zurich Finland/Helsinki") | |
dateTime=$(date +"%A %Y/%m/%d %H:%M %Z") | |
get_timezone(){ | |
dateTimeZoneGet=`echo -n $dateTimeZoneGet; TZ=":$1" date +" %Z: %H:%M %z"` | |
} | |
for timezone in ${timeZones[@]}; do | |
get_timezone $timezone | |
done | |
echo "$dateTime ($dateTimeZoneGet)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment