Linux: Get Time in Timezone

Objective: Get the current time in a different timezone on Linux without changing the system timezone.

The easiest way to show the current time on a different timezone is to set the TZ environment variable before calling date. To show the current time in Singapore, set TZ to Asia/Singapore.

$ TZ=Asia/Singapore date
Sun May 21 18:01:48 SGT 2017

To get the list of possible values of TZ, use tzselect or timedatectl commands. tzselect is a menu driven utility to view timezones and to view timezones using timedatectl, use the list-timezones option. To list all timezones in Asia using timedatectl, use the following command syntax.

$ timedatectl list-timezones | grep Asia

The other method is to use zdump utility to print the time in a different timezone. To get the current time in Singapore using zdump, use the following command syntax.

$ zdump Asia/Singapore
Asia/Singapore  Sun May 21 18:22:41 2017 SGT

Ibrahim is a technology enthusiast with a keen interest in *NIX (Unix, Linux) systems, Android, open source and other tech related stuff. When his cpu load is low, you can probably find him online playing on his Xbox or PlayStation.