LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 10-15-2005, 05:18 AM   #1
davholla
Member
 
Registered: Jun 2003
Location: London
Distribution: Mandriva 2008 Spring
Posts: 652

Rep: Reputation: 31
Change timezone using date


I know that date -u sets timezone to be GMT, but I want to set it to be UK time how do I do that ?
 
Old 10-15-2005, 05:37 AM   #2
TigerOC
Senior Member
 
Registered: Jan 2003
Location: Devon, UK
Distribution: Debian Etc/kernel 2.6.18-4K7
Posts: 2,380

Rep: Reputation: 49
date -u sets the clock to UTC not gmt. You'll find info on setting time zones and clocks here .
 
Old 10-15-2005, 08:44 AM   #3
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
Note: I'm using US/Eastern zone
You should be able to find your zone in /usr/share/zoneinfo

From what I found in google, using the date command for timezone should look like this.
date -s "10/15/2005 09:40:00 EDT" but that doesn't seem to work on my FC4 box.

I was able to change it with the command: export TZ="US/Eastern"

I found it to be just as easy to edit the /etc/sysconfig/clock, so this is my prefered method...
ZONE="America/New_York"
UTC=false
ARC=false

Then, I ran these commands:
rm -f /etc/localtime
ln -sf /usr/share/zoneinfo/US/Eastern /etc/localtime
date -s "10/15/2005 09:40:00"
/sbin/hwclock --systohc

You may have to log out and back in to see the correct time.

Last edited by homey; 10-15-2005 at 08:45 AM.
 
Old 10-15-2005, 09:52 AM   #4
davholla
Member
 
Registered: Jun 2003
Location: London
Distribution: Mandriva 2008 Spring
Posts: 652

Original Poster
Rep: Reputation: 31
Quote:
Originally posted by homey

Then, I ran these commands:
rm -f /etc/localtime
ln -sf /usr/share/zoneinfo/US/Eastern /etc/localtime
date -s "10/15/2005 09:40:00"
/sbin/hwclock --systohc

You may have to log out and back in to see the correct time.
Thanks I did the above only using
ln -sf /usr/share/zoneinfo/GB /etc/localtime


The only strange thing after logging in and out I get the right date but it is GMT which is not correct - it should be BST.
 
Old 10-15-2005, 11:37 AM   #5
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
You may end up using a config tool in yast or maybe the command: timeconfig
or even export TZ="GB"
 
Old 10-16-2005, 03:47 AM   #6
davholla
Member
 
Registered: Jun 2003
Location: London
Distribution: Mandriva 2008 Spring
Posts: 652

Original Poster
Rep: Reputation: 31
Actually I am using Knoppix 3.9 installed to my hard drive- I must change that.

The annoying thing is that after rebooting my time zone has been reset back to EDT - how do I stop that.
Also bizarelly the date is incorrect ! It thinks that today is the 11th of March 2006

Last edited by davholla; 10-16-2005 at 03:51 AM.
 
Old 10-16-2005, 07:29 AM   #7
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
Here are a couple more time zone tools.
Code:
zdump US/Eastern
or tzconfig
Here is the command for setting the date and time.
Code:
date -s "10/16/2005 08:30:00"
or  ``date 10160830

Last edited by homey; 10-16-2005 at 07:30 AM.
 
Old 10-16-2005, 02:16 PM   #8
davholla
Member
 
Registered: Jun 2003
Location: London
Distribution: Mandriva 2008 Spring
Posts: 652

Original Poster
Rep: Reputation: 31
Thanks I think zdump worked. I will have to see tomorrow.
 
Old 10-17-2005, 02:39 PM   #9
davholla
Member
 
Registered: Jun 2003
Location: London
Distribution: Mandriva 2008 Spring
Posts: 652

Original Poster
Rep: Reputation: 31
The change is not permanent

After turning on the pc, I get the wrong date again.

Also tzconfig does not work, my timezone is london but date says different.
Code:
tzconfig
Your current time zone is set to Europe/London
Do you want to change that? [n]: n
Your time zone will not be changed
root@Knoppix:~# date
Mon Oct 17 20:40:16 EDT 2005
 
Old 10-17-2005, 03:32 PM   #10
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
How about if you change
ln -sf /usr/share/zoneinfo/GB /etc/localtime

to this
rm -f /etc/localtime
ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime
 
Old 10-21-2005, 08:16 AM   #11
davholla
Member
 
Registered: Jun 2003
Location: London
Distribution: Mandriva 2008 Spring
Posts: 652

Original Poster
Rep: Reputation: 31
Sadly no

Quote:
Originally posted by homey
How about if you change
ln -sf /usr/share/zoneinfo/GB /etc/localtime

to this
rm -f /etc/localtime
ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime
It only works until i have to turn my pc off and on again (ie go to bed).
 
Old 10-21-2005, 08:42 AM   #12
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
Quote:
tzconfig
Your current time zone is set to Europe/London
Do you want to change that? [n]: n
Maybe you can fool it by selecting "yes" , change it to somewhere else then back to Europe/London.
 
Old 10-21-2005, 08:48 AM   #13
davholla
Member
 
Registered: Jun 2003
Location: London
Distribution: Mandriva 2008 Spring
Posts: 652

Original Poster
Rep: Reputation: 31
Good idea I will try that tonight
 
Old 10-22-2005, 09:33 AM   #14
davholla
Member
 
Registered: Jun 2003
Location: London
Distribution: Mandriva 2008 Spring
Posts: 652

Original Poster
Rep: Reputation: 31
Well it worked - until I turned it back on and it was the same as before.
Thanks for the help. Any more ideas ?
 
Old 10-22-2005, 09:51 AM   #15
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
Quote:
It only works until i have to turn my pc off and on again (ie go to bed).
There's your problem! True Linux geeks never go to bed!

Sorry, I'm fresh out of ideas.

Redhat / Fedora has a file where the info is stored: /etc/sysconfig/clock
ZONE="America/New_York"
UTC=false
ARC=false

I don't know if Knoppix / Debian has anything similar.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change Date hansi umayangan Linux - General 2 03-01-2005 12:17 AM
Change Date hansi umayangan General 1 02-28-2005 12:02 AM
How to configure TimeZone to change automatic .. piraxter Slackware 1 04-09-2003 11:14 PM
Change date mbayeb Linux - General 2 01-31-2003 08:57 AM
Change Date ?? joetec Linux - General 1 01-08-2003 07:50 PM


All times are GMT -5. The time now is 11:15 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration