Ubuntu Linux, ubuntu desktop, Linux operating system, ubuntu guide

Tag: Date change in ubuntu

System Hardware clock and Date Synchronization and Change in Linux

by on May.29, 2010, under RHEL5, Ubuntu, ubuntu 10.04, ubuntu 7.10, ubuntu 8.10, ubuntu 9.04, Ubuntu 9.10

Resetting the Date and Time

The Ubuntu installer queries during installation for default time zone settings, and whether your computer’s hardware clock is set to Greenwich mean time (GMT)more properly known as UTC or coordinated universal time.

Linux provides a system date and time; your computer hardware provides a hardware clock-based time. Ubuntu provides several date and time utilities you can use at the command line or during an X session, including these:

date Used to display, set, or adjust the system date and time from the command line

hwclock A root command to display, set, adjust, and synchronize hardware and system clocks

time-admin Ubuntu’s graphical date, time, and network time configuration tool

Using the date Command

Use the date command to display or set your Linux system time. This command requires you to use a specific sequence of numbers to represent the desired date and time. To see your Linux system’s idea of the current date and time, use the date command like this:

ubuntu@linux-desktop:~$ sudo date 

Tue Aug 18 22:34:21 IST 2009

To adjust your system’s time (say, to August 18, 2010 at 8 a.m.), use a command line with the month, day, hour, minute, and year, like so:

$ sudo date 081808002010
Wed Aug 18 08:00:00 IST 2010

Using the hwclock Command

Use the hwclock command to display or set your Linux system time, display or set your PC’s hardware clock, or to synchronize the system and hardware times. To see your hardware date and time, use hwclock with its –show option like so:

ubuntu@linux-desktop:~$ sudo hwclock --show

Tuesday 18 August 2009 10:42:06 PM IST  -0.228789 seconds

Use hwclock with its –set and –date options to manually set the hardware clock like so:

$ sudo hwclock --set --date "08/18/09 23:00:00"

$ sudo hwclock --show

Tuesday 18 August 2009 11:00:00 PM IST  -0.228789 seconds

In these examples, the hardware clock has been set using hwclock, which is then used again to verify the new hardware date and time. You can also hwclock to set the Linux system date and time date using your hardware clock’s values with the Linux system date and time.

For example, to set the system time from your PC’s hardware clock, use the –hctosys option like so:

$ sudo hwclock --hctosys

To set your hardware clock using the system time, use the –systohc option like so:

$ sudo hwclock --systohc

Changing the Time and Date

Ubuntu’s graphical X tool named time-admin can be used to set your system date and time. The client is found in System, Administration, Time & Date; or you can start it from the command line of an X11 terminal window like this:

$ gksudo time-admin &
3 Comments :, , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!