September 24, 2022

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

For example:

$ TZ=America/New_York date

or

$ 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 i, s, t etc; then enter.

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 nytime run:

$ unalias nytime

To list all alias run:

$ alias

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:

$ tzselect

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
#?

  1. Example drawn from date’s manual which you can see by running $man date in the shell↩︎

✍✍✍✍✍✍✍✍✍✍✍✍✍✍

I do self-funded research and I'm writing a book.

> What's the book about?

About technologies and agency.

Meaning, technologies can foster agency. No doubt. But I am also asking:

Can usage of technologies give us a sense of empowerment while in fact undermining our abilities?

I posted a summary of the prologue on the homepage: https://yctct.com/

✍✍✍✍✍✍✍✍✍✍✍✍✍✍


command-line interface (cli) personal computing gnu linux trisquel office applications wiki

No affiliate links, no analytics, no tracking, no cookies. This work © 2016-2024 by yctct.com is licensed under CC BY-ND 4.0 .   about me   contact me   all entries & tags   FAQ   GPG public key

GPG fingerprint: 2E0F FB60 7FEF 11D0 FB45 4DDC E979 E52A 7036 7A88