LinuxQuestions.org
Help answer threads with 0 replies.
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 08-01-2006, 02:26 AM   #1
lieuquocdat
Member
 
Registered: Jun 2006
Posts: 34

Rep: Reputation: 15
Change system time in linux


How Can I set a new system time in linux?
 
Old 08-01-2006, 02:53 AM   #2
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 63
See the "date" command. Something like
Code:
date MMDDhhmm
if I remember correctly. As root of course.

Yves.
 
Old 08-01-2006, 02:53 AM   #3
pcweirdo
Member
 
Registered: Oct 2004
Location: Melbourne-ish, Australia
Distribution: Gentoo, Windows XP Pro
Posts: 58

Rep: Reputation: 15
lieuquocdat,

I use a bash shell. If you need help with a Linux GUI, I probably can't help you.

Only root can change the system time. To set the time in the software clock (Linux's idea of what time it is), you need the `date' program. Please view `man date'.

At some point, you will probably want the hardware clock to be updated. The program for this is called `hwclock'. Please view `man hwclock' (http://www.die.net/doc/linux/man/man8/hwclock.8.html). Keeping the hardware clock updated will result in the time being correct even after a power cycle.

I can never work out whether my computers' hardware clocks are in UTC or local time. If you dual boot the computer with Windows, you'll need to keep the hardware clock in whatever time zone Windows can deal with. Linux can deal with your hardware clock being in either UTC or local time. `hwclock --utc' or `hwclock --localtime' are used to tell Linux what time zone the hardware clock is kept in.

You may want to mess around with the command-line switches you see in the man pages to get the software clock right, and then run `hwclock --systohc' to save this time to the hardware clock. I apologise that I can't give step-by-step instructions. When I had to fix the time on my Linux system, I simply banged in about ten different combinations of `date' and `hwclock' switches, until I could get the output of `date' to show the right time.

Please ask for more help if necessary.

-pcweirdo.

EDIT: Yves, you beat me to it. I like your answer.

Last edited by pcweirdo; 08-01-2006 at 02:54 AM.
 
Old 08-02-2006, 02:52 AM   #4
lieuquocdat
Member
 
Registered: Jun 2006
Posts: 34

Original Poster
Rep: Reputation: 15
Thank a lot
 
  


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
System time change loccom Linux - General 1 03-16-2005 09:58 AM
Cannot change system time mikemrh9 SUSE / openSUSE 7 01-02-2005 03:06 AM
Change system time JonCooperUK Slackware 4 04-02-2004 09:41 PM
system time is wrong, how do i change? jjd228 Linux - General 8 02-19-2004 04:12 PM
how to change the system time? h/w Linux - Newbie 12 12-29-2003 05:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:09 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration