Howto - Change / Set Timezone In Linux With Example

Linux Clock

Linux_Timezone

We can find the timezone information of the system, using the linux command “date”. The “date” command shows the current date, time and timezone of the system as follows.

# date
Mon Sep 24 16:01:50 EDT 2012

In order to view the timezone information only, you can use the date command as follows.

# date +%Z
EDT

This actually refers to the kernel’s software clock.
If you want to change the timezone of your system, you can do it in following two ways.

1. By using “date” command

To set the time manually, do this:

# date -s "16:15:00"
Mon Sep 24 16:15:00 CST 2012

2. Modifying /etc/localtime

The file “/etc/localtime” defines the current timezone of the server. All available timezone information files are available under the directory “/usr/share/zoneinfo”. In order to set the timezone of the system to “America/New_York”, you need to remove the file “/etc/localtime” and create a symbolic link to the zoneinfo file as follows.

# rm /etc/localtime
# ln –s /usr/share/zoneinfo/America/New_York /etc/localtime

There is a hardware clock also, which is normally used to set the system clock at boot time. The file “/etc/sysconfig/clock” sets whether the hardware clock is set as UTC or localtime.

#cat /etc/sysconfig/clock
ZONE=”America/New_York”
UTC=true
ARC=false

You can view the current time of hardware clock as follows.

# hwclock –show

If you want to update the hardware clock from the system clock, you need to execute the following.

# hwclock –systohc --utc

About Bobbin Zachariah

Founder of LinOxide, passionate lover of Linux and technology writer. Started his career in Linux / Opensource from 2000. Love traveling, blogging and listening music. Reach Bobbin Zachariah about me page and google plus page.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.