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 = {
interested_in(unix, linux, android, open_source, reverse_engineering);
coding(c, shell, perl, php, python, java, javascript, nodejs, angular, react);
plays_on(xbox, ps4);
linux_desktop_user(true);
}