Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Dreamhost seems to think that we like PDT, despite being in the Midwest. How do I change the timezone?

share|improve this question

4 Answers 4

up vote 14 down vote accepted

A tool I found to be easier to use is dpkg-reconfigure. Use:

dpkg-reconfigure tzdata

You will be given a multitude of choices, including some that are not included in tzselect.

share|improve this answer
    
A benefit of doing it this way is that you are doing it in a reproduceable way and limit the chances for doing something wrong like putting in a timezone that does not exist. –  Mogget Apr 21 '13 at 17:56

Update:

The canonical answer (for which Ynhockey deserves credit) appears to be:

dpkg-reconfigure tzdata

My original answer is below. I would simply have deleted this answer entirely but superuser.com doesn't allow accepted answers to be deleted.

http://www.debian-administration.org/articles/213 says

the simple way to edit your timezone is to use the /usr/bin/tzselect command.

...

Once you've set your timezone you might wish to change the UTC setting, upon Debian machines you can find that in the file /etc/default/rcS. Although changing this will require a reboot.

share|improve this answer
    
This not correct. Changing the UTC setting in /etc/default/rcS changes the timezone of the hardware clock - which is a totally different thing, and for most linux users should stay as UTC. (You only need local time if dual booting with windows.) @Ynhockey has the correct answer. –  Ariel Jul 11 '13 at 9:59
    
@Ariel: Thanks. Answer updated as it can't be deleted. –  RedGrittyBrick Jul 11 '13 at 10:09

This is presumably a bit late for the OP, and more intended for other searchers who arrive here.

If you need a non-interactive solution, try this solution from changing timezone with dpkg-reconfigure tzdata and debconf-set-selections

echo "Europe/Zurich" > /etc/timezone 
dpkg-reconfigure -f noninteractive tzdata

You can figure out your timezone by poking around in /usr/share/zoneinfo. In fact the dpkg-reconfigure command above copies the appropriate file from there to /etc/localtime. I used to just do that manually, and it seems to work fine.

Don't be too surprised if long running processes don't pick up the change. eg Apache log timestamps come to mind. Consider whether that matters, and hence whether you need to restart running processes or even reboot.

share|improve this answer

Unfortunately when using

dpkg-reconfigure tzdata

the timezone information is not kept after reboot. You can verify your settings with

diff -s /etc/localtime /usr/share/zoneinfo/`cat /etc/timezone`

To make the change permanent you have to do following:

Debian 7 Wheezy

Edit /etc/adjtime and change the last line from UTC to

LOCAL

Debian 6 Squeeze

Edit /etc/default/rcS

UTC=no

Other solution

Yet another option is executing tzselect and exporting TZ variable, e.g. in your ~/.profile

TZ='Europe/Berlin'; export TZ

it will create symlink

/etc/localtime -> /usr/share/zoneinfo/UTC
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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