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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
10-15-2005, 05:18 AM
|
#1
|
Member
Registered: Jun 2003
Location: London
Distribution: Linux Mint 13 Maya
Posts: 729
Rep:
|
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 ?
|
|
|
10-15-2005, 05:37 AM
|
#2
|
Senior Member
Registered: Jan 2003
Location: Devon, UK
Distribution: Debian Etc/kernel 2.6.18-4K7
Posts: 2,380
Rep:
|
date -u sets the clock to UTC not gmt. You'll find info on setting time zones and clocks here .
|
|
|
10-15-2005, 08:44 AM
|
#3
|
Senior Member
Registered: Oct 2003
Posts: 3,057
Rep:
|
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.
|
|
|
10-15-2005, 09:52 AM
|
#4
|
Member
Registered: Jun 2003
Location: London
Distribution: Linux Mint 13 Maya
Posts: 729
Original Poster
Rep:
|
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.
|
|
|
10-15-2005, 11:37 AM
|
#5
|
Senior Member
Registered: Oct 2003
Posts: 3,057
Rep:
|
You may end up using a config tool in yast or maybe the command: timeconfig
or even export TZ="GB"
|
|
|
10-16-2005, 03:47 AM
|
#6
|
Member
Registered: Jun 2003
Location: London
Distribution: Linux Mint 13 Maya
Posts: 729
Original Poster
Rep:
|
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.
|
|
|
10-16-2005, 07:29 AM
|
#7
|
Senior Member
Registered: Oct 2003
Posts: 3,057
Rep:
|
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.
|
|
|
10-16-2005, 02:16 PM
|
#8
|
Member
Registered: Jun 2003
Location: London
Distribution: Linux Mint 13 Maya
Posts: 729
Original Poster
Rep:
|
Thanks I think zdump worked. I will have to see tomorrow.
|
|
|
10-17-2005, 02:39 PM
|
#9
|
Member
Registered: Jun 2003
Location: London
Distribution: Linux Mint 13 Maya
Posts: 729
Original Poster
Rep:
|
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
|
|
|
10-17-2005, 03:32 PM
|
#10
|
Senior Member
Registered: Oct 2003
Posts: 3,057
Rep:
|
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
|
|
|
10-21-2005, 08:16 AM
|
#11
|
Member
Registered: Jun 2003
Location: London
Distribution: Linux Mint 13 Maya
Posts: 729
Original Poster
Rep:
|
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).
|
|
|
10-21-2005, 08:42 AM
|
#12
|
Senior Member
Registered: Oct 2003
Posts: 3,057
Rep:
|
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.
|
|
|
10-21-2005, 08:48 AM
|
#13
|
Member
Registered: Jun 2003
Location: London
Distribution: Linux Mint 13 Maya
Posts: 729
Original Poster
Rep:
|
Good idea I will try that tonight
|
|
|
10-22-2005, 09:33 AM
|
#14
|
Member
Registered: Jun 2003
Location: London
Distribution: Linux Mint 13 Maya
Posts: 729
Original Poster
Rep:
|
Well it worked - until I turned it back on and it was the same as before.
Thanks for the help. Any more ideas ?
|
|
|
10-22-2005, 09:51 AM
|
#15
|
Senior Member
Registered: Oct 2003
Posts: 3,057
Rep:
|
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.
|
|
|
All times are GMT -5. The time now is 02:53 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|