Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to change the date of my system. I'm running a Linux CentOS 5.6.

# date +%Z
UTC
# date
Thu Oct  6 11:42:45 UTC 2011

How do I change the hour to be UTC/GMT +1?

share|improve this question
up vote 9 down vote accepted

The normal way is to set your timezone. There are a bunch of files stored by region in the following directory:

/usr/share/zoneinfo

Take a look and find the one which matches your region. Then you have to create a symlink from /etc/localtime:

sudo rm /etc/localtime
sudo ln -s /usr/share/zoneinfo/Europe/London /etc/localtime
share|improve this answer
    
Europe/London is not UTC+1 – bebbo Mar 28 at 23:47

You need to change the timezone.

  • To do it system-wide, symlink /etc/localtime to the apropriate file in /usr/share/zoneinfo. For example:

    ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime
    

    In CentOS, you might need to also edit /etc/sysconfig/clock.

  • To change the timezone just for the current user, set $TZ instead:

    export TZ="Europe/Paris"
    

Note that date -u must always return correct UTC time.

share|improve this answer
    
Isn't "Europe/Paris" the same as CET which differs from UTC+1? – bebbo Mar 28 at 23:51

I have tried to do this today, using /usr/share/zoneinfo/Etc/GMT+1 as link. (CentOS 7.0) In a strage way, I've got -1 hour. So I have tried GMT-1, and have now +1 hour. Looks strange, but works for me.

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.