Last active
March 21, 2024 15:59
-
-
Save benob/cb71f72f7348aab0f351cc46d10b59d6 to your computer and use it in GitHub Desktop.
Revisions
-
benob revised this gist
Mar 21, 2024 . 1 changed file with 5 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -5,10 +5,11 @@ ref=$1 # fill this list with timezones you are interested in; first element is reference timezone zones[1]=`cat /etc/timezone` zones[2]="Europe/London" zones[3]="Asia/Calcutta" zones[4]="Asia/Tokyo" zones[5]="America/Los_Angeles" zones[6]="America/Montreal" date -d "$ref" +'%a %D (%Z %:z)' for zone in "${zones[@]}"; do -
benob renamed this gist
Mar 21, 2024 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -12,9 +12,9 @@ zones[5]="America/Montreal" date -d "$ref" +'%a %D (%Z %:z)' for zone in "${zones[@]}"; do printf "%-11s" `echo $zone|sed 's/.*\///;s/.*\(.\{10\}\)/…\1/'` # show converted time for timeslots from 8am to 5pm for time in `seq 8 17`; do echo -n " "$(TZ=$zone date -d "TZ=\"${zones[1]}\" $ref $time:00" +%H:%M) done # compute and show difference with local timezone -
benob created this gist
Mar 21, 2024 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ #!/bin/bash # pass date as argument, empty is today ref=$1 # fill this list with timezones you are interested in; first element is reference timezone zones[1]=`cat /etc/timezone` zones[2]="Asia/Calcutta" zones[3]="Asia/Tokyo" zones[4]="Australia/Brisbane" zones[5]="America/Montreal" date -d "$ref" +'%a %D (%Z %:z)' for zone in "${zones[@]}"; do printf "%-20s " $zone # show converted time for timeslots from 8am to 7pm for time in `seq 8 19`; do echo -n " "$(TZ=$zone date -d "TZ=\"${zones[1]}\" $ref $time:00" +%H:%M) done # compute and show difference with local timezone diff=$(expr $(printf "%g" `TZ=$zone date +%z`) - $(printf "%g" `date +%z`)|sed 's/..$/:&/;s/^/+/;s/^+-/-/') if [ "$diff" != +0 ]; then echo " ($diff)" else echo fi done