Using TZ and "date" to find the current date and time anywhere on Earth
From a Linux terminal, if you need to find out what time it is in a different time zone or another country, you can use the
date command. Just override the
TZ environment variable when you run
[user@host ~]$ date Mon Dec 14 22:10:59 CST 2015 [user@host ~]$ TZ=Poland date Tue Dec 15 05:11:03 CET 2015 [user@host ~]$ TZ=Japan date Tue Dec 15 13:11:07 JST 2015 [user@host ~]$ TZ=Australia/Melbourne date Tue Dec 15 15:12:36 AEDT 2015 [user@host ~]$ TZ=Australia/Perth date Tue Dec 15 12:12:41 AWST 2015
The full list of supported time zones will be somewhere on your filesystem; on many distributions, they're located at
/usr/share/zoneinfo/. If you aren't sure where to find them, Wikipedia has a tz database that's mostly accurate.
Because some of the time zone names are cumbersome to remember and type, consider using aliases if you need to reference international times frequently. You can add commands like this to your .bash_profile or .bashrc,
alias nyctime='TZ=America/New_York date' alias hktime='TZ=Asia/Hong_Kong date' alias jtime='TZ=Japan date'
Now you can just run the aliases from your shell:
[user@host ~]$ date Mon Dec 14 22:16:08 CST 2015 [user@host ~]$ jtime Tue Dec 15 13:16:10 JST 2015 [user@host ~]$ nyctime Mon Dec 14 23:16:14 CST 2015
This also works on FreeBSD, but the time zone naming scheme is different for many countries. For example, Japanese time is referenced on FreeBSD using
TZ=Asia/Tokyo rather than
TZ=Japan. Explore the contents of
/usr/share/zoneinfo/ to find the zone you're looking for.