Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: How to change the Time zone in a linux machine  (Read 2539 times)

0 Members and 1 Guest are viewing this topic.

Leo.Prince

  • Guest
How to change the Time zone in a linux machine
« on: November 03, 2013, 07:19:01 pm »
Hi,

We all know the server location and the user/owner location might be different and hence time zone. In such cases user needed to edit/set the server time zone to that with the user. The changing of server time zone is easy and simple.

For example: Assume that your current timezone is UTC as shown below. You would like to change this to Pacific Time.

Code: [Select]
date
Mon Sep 17 22:59:24 UTC 2010

On some distributions (for example, CentOS), the timezone is controlled by /etc/localtime file. Delete the current localtime file under /etc/ directory

Code: [Select]
rm -f /etc/localtime
All US timezones are located under under the /usr/share/zoneinfo/US directory

Code: [Select]
ls /usr/share/zoneinfo/US/
Alaska          Arizona         Eastern         Hawaii          Michigan        Pacific

Aleutian        Central         East-Indiana    Indiana-Starke  Mountain        Samoa


: For other country timezones, browse the /usr/share/zoneinfo directory

Now create a soft link with the PST time zone to the localtime directory

Code: [Select]
ln -s /usr/share/zoneinfo/US/Pacific /etc/localtime
Now the timezone on your Linux system is changed to US Pacific time. See

Code: [Select]
date
Mon Sep 17 23:10:14 PDT 2010

Thanks  8)