til

Today I Learned: collection of notes, tips and tricks and stuff I learn from day to day working with computers and technology as an open source contributor and product manager

View project on GitHub

Getting time in another timezone

Sometimes you need the time in another timezone, to open a browser and google or you grab your iPhone and open the clock app or you install one of the timezone applications on your Mac.

Well there is absolutely no need to, since you have the date command.

$ TZ=America/New_York date
TZ=America/New_York date

2017-10-29 13:24:50

So when you are eagerly awaiting you favorite Twitch live-stream to start you can do the following:

$ while true; do clear; echo -n "New York; "; TZ=America/New_York date; echo -n "Copenhagen: "; date; sleep 60; done
New York; 2017-10-29 13:24:50
Copenhagen: 2017-10-29 18:24:50

References