Show the time of other time zones from the command line
To show the time of a time zone in your shell (terminal) run:
$ TZ=<tzdata> date
$ TZ=America/New_York date
$ TZ=Asia/Istanbul date
Use history to look up a time again
If you need to look up a time again, you can use
CRTL + R to retrieve a command from your shell history.
For example: type
CRTL + R and then start typing ‘Istanbul’ for instance
t etc; then
Set an alias (shortcut)
You can also assign an alias.
To assign an alias (shortcut) for
$ TZ=America/New_York date you can run:
$ alias nytime='TZ=America/New_York date'
now if you run
$ nytime the shell should output the date and time in New York.
To undo the alias
$ unalias nytime
To list all alias run:
Show the local time for a given day and time in another time zone
For example, to show the local time for 9 AM next Friday on the west coast of the US run:
$ date --date='TZ="America/Los_Angeles" 09:00 next Fri'
should show the equivalent time in your (local) time zone1.
Find the ‘tzdata’ of the time you want to look up
You can find a list of all
tzdata by running:
You should see:
Please identify a location so that time zone rules can be set correctly. Please select a continent, ocean, "coord", or "TZ". 1) Africa 7) Europe 2) Americas 8) Indian Ocean 3) Antarctica 9) Pacific Ocean 4) Asia 10) coord - I want to use geographical coordinates. 5) Atlantic Ocean 11) TZ - I want to specify the timezone using the Posix TZ format. 6) Australia #?
Example drawn from date’s manual which you can see by running
$man datein the shell↩︎