I have friends all over the globe and before calling them I need to know their current time. Is there an application in Linux where one can query a city (if exists) in terminal (something like this): time miami

P.S: Yes I know that I can query it from Google but I prefer using the terminal


The date command will give you the current date/time based on your locale.
You can change that, one time only, by prefixing the command with a different timezone

TZ=CST6CDT date # Will print the current time in the USA Central time
TZ=Chicago date # will do the same, iff Chicago is listed by name in the /usr/share/zoneinfo/ dir hierarchy

Then to simplify ease of access, just create aliases in you .bashrc file, eg.

alias dad='TZ=Paris date'
alias fred='TZ=Amsterdam date'


  • very nice answer, thanks. let's say i want miami (not listed under /usr/share/zoneinfo/) and how do i find out its zone code (CST6...)? – sterz Mar 8 '12 at 18:54
  • 1
    You could use google maps or earth, but in this case I'll just tell you. Miami is in the Eastern Time zone, EST5EDT, same as New_York (Miami's just a little further south). Quick G search, found and like this, gives TZ – bsd Mar 8 '12 at 19:26
  • 1
    “in the /usr/share/zoneinfo hierarchy”? I've never seen that. AFAIK you need the full path from the zoneinfo directory, e.g. TZ=America/Chicago or TZ=Europe/Paris or TZ=Hongkong. – Gilles 'SO- stop being evil' Mar 8 '12 at 23:18
  • Nope, just the City is enough, again I speak empirically. I tried it, and it works. I'm in America but the TZ=Paris worked fine. If I were going to rely on this, personally I'd stick with the EST5DST form. – bsd Mar 8 '12 at 23:26
  • Seems Gilles is right. It works for me only with full path. – manatwork Mar 9 '12 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.