Tuesday, September 23, 2008

Changing the Date/Time on Linux

Changing the timezone to Johannesburg:
$ ln -s /usr/shar/zoneinfo/Africa/Johannesburg /etc/localtime

Changing the date/time:
To change the date/time use the following syntax:
$ date MMDDhhmmYYYY
where MM is the month, DD is the day, hh is the hour, mm is the minute and YYYY is the year.

Updating the hw clock:
$ hwclock --systohc

Checking the hw clock:
$ hwclock --show

To maintain the timezone through a restart you may need to change the /etc/sysconfig/clock file.

No comments:

Post a Comment