Add Your City To Linux's List of Time Zones

 in

Ever feel like you're Rodney Dangerfield? You live someplace and Linux shows you no respect, time-zone-wise that is. What I mean is that you live somewhere that's not one of the time-zones that comes predefined with Linux. If that sounds like you, then read on and get Linux to show you a little respect.

Let's say for instance that we want to add Seattle, WA (the birthplace of Linux Journal) to the list of time-zones that Linux knows about. First, look in the list of predefined time-zones for a city that's in the the same time-zone as the city you want to add, in this case Los Angeles. Then as root do the following:

$ cd /usr/share/zoneinfo
$ cp America/Los_Angeles America/Seattle

This will make the new "Seattle" time-zone use the same time-zone data as "Los Angeles" uses. Note: if /usr/share/zoneinfo doesn't exist try /usr/lib/zoneinfo.

Now edit the file /usr/share/zoneinfo/zone.tab and find the line for the time-zone that you copied, in this case "Los Angeles":

US   +340308-1181434   America/Los_Angeles   Pacific Time

Duplicate that line and change the old time-zone name to the new one:

US   +473622-1221955   America/Seattle       Pacific Time

The numbers are the latitude and longitude of the city in the form +/-DDMM+/-DDDMM or +/-DDMMSS+/-DDDMMSS (D=Degrees, M=Minutes, S=Seconds). You can find that information on the web, for example at infoplease.

Now, logout and log back in and you should see your new time-zone in the list of available time-zones. The screenshot below shows it added to the list of time-zones that are displayed when I hover the mouse over the KDE clock.

timezone.jpg
AttachmentSize
timezone.jpg20.36 KB
______________________

Mitch Frazier is an Associate Editor for Linux Journal.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Lotus Running on Linux

lotus notes support's picture

Very useful topic. We are running Lotus Domino server on the Linux platform and it took oyr admin person a while to figure it out.

Very simple indeed....

Rey's picture

Thank you for sharing, although I don't change time zones often, it's a good idea, if you want to further customize your system.

Colour Graphic Design

Not only in the US Central Time Zone

Carl Snyder's picture

do you have a big blank. Almost all time zones show few selections. You have to pick the large city which you are sure is in the same time zone as you are because, for example, Detroit is not listed, nor any city in my home State of Indiana. In any case, if I selected Indiana, it has been recent enough that we changed back to using Daylight Savings Time that many databases still list the state as not using EDT.

Good, but I was hoping for more...

Anonymous's picture

This is useful information, however I was hoping for more. Every time I install a new version of my favorite distro, I have to select a city that is in the same time zone as my own, but it is not my city. That means I would have to perform this tweak on each machine every time. I have installed Linux on 6 machines and now have a 7th one to do. I was hoping that this article would instruct me on how to submit my city so it would be available the next time I installed the latest distro. I guess I had this crazy idea that the Linux distro producers could actually share the time zone city package amongst themselves and my city would now be there after I had submitted it to a general location they could all pull their data from. Maybe someday we will get there.

I Feel Your Pain

Mitch Frazier's picture

You're right that would be nice.

Mitch Frazier is an Associate Editor for Linux Journal.

Gnome is lost

Linuxrebel's picture

Unfortunately Gnome can't figure this all out. Parts of it think the timezone is Pacific and parts think it isn't there. Seems that somewhere in Gnome someone did some hard coding. Which is why I rarely use Gnome, it's too windowsy for my taste, some like, I don't

stupid

Anonymous's picture

WTF Who cares as long as it shows the right time. The cities are shown only for reference - it makes to sense to list *every single city in the state/country/world*.

Instead of picking a city it makes more sense to pick a timezone, eg, US/Eastern, US/Central, etc.

Nice

Patrick Miami's picture

I care. I'd like to personalize my system as much as I can. Then I show it to my friends and they envy me a bit :).

Do you know it's a best way to learn your system? This article is very useful and I can't say the same about your comment.

--
Miami Web Design

That was so simple!

Crazy Henaway's picture

Now only if there was an easy way for folks to submit thier TZ information to some central repository of TZ info that all distros could make use of! That'd be pretty sweet!

Am I the only who noticed . . .

Anonymous's picture

That there is a huge gap in the standard Linux TZ base, almost the entire mid north America in the US is blank. I have to always choose Chicago even though Saint Louis would be a lost closer and more logical. I notice this on the installation of nearly every Linux distro I've tried.

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState