#22 Displaying the Time in Different Time Zones

The most fundamental requirement for a working date command is that it display the date and time in your time zone. But what if you have users across multiple time zones? Or, more likely, what if you have friends and colleagues in different locations, and you're always confused about what time it is in, say, Casablanca, Vatican City, or Sydney?

It turns out that most modern Unixes have a date command built atop an amazing time zone database. Usually stored in /usr/share/zoneinfo, this database lists over 250 different regions and knows how to ascertain the appropriate time zone for each. Because the date command pays attention to the TZ time zone variable, and because that variable can be ...

Get Wicked Cool Shell Scripts now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.