Categorized | News

Linux: Changing the System Time/Date

Posted on 11 September 2002 by Demian Turner

Changing the system date/time is a typical task for anyone managing a Linux system. Often if you have clients in different timezones the system time/date will need adjusting. The same command date that you use to get the current date/time is also used to set the system clock, provided you are logged in as root 😉

Examples:

  • date – Displays:  Sun Jun 11 12:56:54 CDT 2002
  • date MMDDhhmmCCYY.ss  – Will set the system date:
    • MM month
    • DD day within month
    • hh hour
    • mm minute
    • CC first two digits of year (optional)
    • YY last two digits of year (optional)
    • ss second (optional)

So an example of this would be:

date 06111256

Quite often it is a good idea to sync the hardware clock to the system time you have just set, this is done by executing the following:

/sbin/hwclock –hctosys

Bookmark and Share

Leave a Reply

Categories

Books

Demian Turner's currently-reading book recommendations, reviews, favorite quotes, book clubs, book trivia, book lists

Facebook