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 ?
|
date -u sets the clock to UTC not gmt. You'll find info on setting time zones and clocks here .
|
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. |
Quote:
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. |
You may end up using a config tool in yast or maybe the command: timeconfig
or even export TZ="GB" |
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 |
Here are a couple more time zone tools.
Code:
zdump US/Eastern Code:
date -s "10/16/2005 08:30:00" |
Thanks I think zdump worked. I will have to see tomorrow.
|
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 |
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 |
Sadly no
Quote:
|
Quote:
|
Good idea I will try that tonight
|
Well it worked - until I turned it back on and it was the same as before.
Thanks for the help. Any more ideas ? |
Quote:
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. |
All times are GMT -5. The time now is 11:36 AM. |