Categories
SysOps

How to display current date-time in different timezone

Use date utility to display current date time in different timezone

Display current date-time.

$ date
Tue Apr 13 22:54:30 CEST 2021

Display current date-time in Europe using general time zone data (tzdata package).

$ for timezone in /usr/share/zoneinfo/posix/*/*; do printf "%-32s %s\n" "$(LC_ALL=C TZ=$timezone date +"%a, %-d %b %Y, %T %Z")" "$timezone"; done | grep Europe
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Amsterdam
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Andorra
Wed, 14 Apr 2021, 00:54:34 +04   /usr/share/zoneinfo/posix/Europe/Astrakhan 
Tue, 13 Apr 2021, 23:54:34 EEST  /usr/share/zoneinfo/posix/Europe/Athens  
Tue, 13 Apr 2021, 21:54:34 BST   /usr/share/zoneinfo/posix/Europe/Belfast
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Belgrade  
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Berlin
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Bratislava
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Brussels 
Tue, 13 Apr 2021, 23:54:34 EEST  /usr/share/zoneinfo/posix/Europe/Bucharest
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Budapest
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Busingen
Tue, 13 Apr 2021, 23:54:34 EEST  /usr/share/zoneinfo/posix/Europe/Chisinau 
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Copenhagen
Tue, 13 Apr 2021, 21:54:34 IST   /usr/share/zoneinfo/posix/Europe/Dublin
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Gibraltar
Tue, 13 Apr 2021, 21:54:34 BST   /usr/share/zoneinfo/posix/Europe/Guernsey
Tue, 13 Apr 2021, 23:54:34 EEST  /usr/share/zoneinfo/posix/Europe/Helsinki
Tue, 13 Apr 2021, 21:54:34 BST   /usr/share/zoneinfo/posix/Europe/Isle_of_Man
Tue, 13 Apr 2021, 23:54:34 +03   /usr/share/zoneinfo/posix/Europe/Istanbul
Tue, 13 Apr 2021, 21:54:34 BST   /usr/share/zoneinfo/posix/Europe/Jersey
Tue, 13 Apr 2021, 22:54:34 EET   /usr/share/zoneinfo/posix/Europe/Kaliningrad
Tue, 13 Apr 2021, 23:54:34 EEST  /usr/share/zoneinfo/posix/Europe/Kiev  
Tue, 13 Apr 2021, 23:54:34 +03   /usr/share/zoneinfo/posix/Europe/Kirov
Tue, 13 Apr 2021, 21:54:34 WEST  /usr/share/zoneinfo/posix/Europe/Lisbon
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Ljubljana
Tue, 13 Apr 2021, 21:54:34 BST   /usr/share/zoneinfo/posix/Europe/London
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Luxembourg
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Madrid
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Malta
Tue, 13 Apr 2021, 23:54:34 EEST  /usr/share/zoneinfo/posix/Europe/Mariehamn
Tue, 13 Apr 2021, 23:54:34 +03   /usr/share/zoneinfo/posix/Europe/Minsk
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Monaco
Tue, 13 Apr 2021, 23:54:34 MSK   /usr/share/zoneinfo/posix/Europe/Moscow
Tue, 13 Apr 2021, 23:54:34 EEST  /usr/share/zoneinfo/posix/Europe/Nicosia
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Oslo
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Paris
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Podgorica
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Prague
Tue, 13 Apr 2021, 23:54:34 EEST  /usr/share/zoneinfo/posix/Europe/Riga
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Rome
Wed, 14 Apr 2021, 00:54:34 +04   /usr/share/zoneinfo/posix/Europe/Samara
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/San_Marino
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Sarajevo
Wed, 14 Apr 2021, 00:54:34 +04   /usr/share/zoneinfo/posix/Europe/Saratov
Tue, 13 Apr 2021, 23:54:34 MSK   /usr/share/zoneinfo/posix/Europe/Simferopol
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Skopje
Tue, 13 Apr 2021, 23:54:34 EEST  /usr/share/zoneinfo/posix/Europe/Sofia
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Stockholm
Tue, 13 Apr 2021, 23:54:34 EEST  /usr/share/zoneinfo/posix/Europe/Tallinn
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Tirane
Tue, 13 Apr 2021, 23:54:34 EEST  /usr/share/zoneinfo/posix/Europe/Tiraspol
Wed, 14 Apr 2021, 00:54:34 +04   /usr/share/zoneinfo/posix/Europe/Ulyanovsk
Tue, 13 Apr 2021, 23:54:34 EEST  /usr/share/zoneinfo/posix/Europe/Uzhgorod
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Vaduz
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Vatican
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Vienna
Tue, 13 Apr 2021, 23:54:34 EEST  /usr/share/zoneinfo/posix/Europe/Vilnius
Tue, 13 Apr 2021, 23:54:34 +03   /usr/share/zoneinfo/posix/Europe/Volgograd
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Warsaw
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Zagreb
Tue, 13 Apr 2021, 23:54:34 EEST  /usr/share/zoneinfo/posix/Europe/Zaporozhye
Tue, 13 Apr 2021, 22:54:34 CEST  /usr/share/zoneinfo/posix/Europe/Zurich

Display current date-time in London using timedatectl systemd utility to get zone data.

$ for timezone in $(timedatectl list-timezones); do printf "%-32s %s\n" "$(LC_ALL=C TZ=$timezone date +"%a, %-d %b %Y, %T %Z")" "$timezone"; done | grep London
Tue, 13 Apr 2021, 21:54:46 BST   Europe/London