Friday, June 1

How to Change Time Zone in Linux RHEL/CentOS 6&7


Time Zone change is required Some times  when we move our Machines(VMs) from one location to another location.
You can easily change timezone in RHEL/CentOS using the following methods.
Check which time zone you are in by using date command.

Example:
[root@bsrtech ~]# date
Fri Jun  1 12:26:53 IST 2018

Actually My Machine(VM) is moved from India to US(Eastern Time)  Data Centre. Here i am showing change time zone from IST to EDT.

In Linux timezone data is taken from /etc/localtime which is linked to one of the file located in /usr/share/zoneinfo/*
Delete the current localtime file under /etc/ directory, before deleting backup the localtime file

[root@bsrtech ~]# cd /etc
[root@bsrtech ~]# cp /etc/localtime /etc/localtime_bkp_8MAR2018
[root@bsrtech ~]# rm localtime

All US timezones are located under the /usr/share/zoneinfo/US directory as shown below.

[root@bsrtech US]# ls
Alaska    Arizona  Eastern       Hawaii          Michigan  Pacific      Samoa
Aleutian  Central  East-Indiana  Indiana-Starke  Mountain  Pacific-New




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

Link the Eastern file from the above US directory to the /etc/localtime directory as shown below.

[root@bsrtech US]# # ln -s /usr/share/zoneinfo/US/Eastern   /etc/localtime

Now the timezone on your Linux system is changed to US Eastern time as shown below.

[root@bsrtech ~]# date
Fri Jun  1 03:19:21 EDT 2018

Note: The date command can be used for both viewing and changing the date and time. Change the Time using date Command

Set Manual Time
[root@bsrtech ~]# date -s "01 JUNE 2018 02:34:00"
FRI June  1 02:34:00 EDT 2018

5 comments:

  1. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. Big data is a term that describes the large volume of data – both structured and unstructured – that inundates a business on a day-to-day basis. big data projects for students But it’s not the amount of data that’s important.Project Center in Chennai

      Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Corporate TRaining Spring Framework the authors explore the idea of using Java in Big Data platforms.

      Spring Training in Chennai

      The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  2. Thanks For Sharing a very Nice Informative Information which I very Beneficial for everyone Otherwise if anyone Want to Setup / activate Ms Office So Please visit the Website- https://msofficeset-up.com/

    Here is the best Software Company for MS Office Set up
    www.office.com/activate
    office.com/activate

    ReplyDelete

:: Linux - Legends ::