20 Apr 2018

Check and Change current TimeZone in CentOS 6 and CentOS 7

change timezone

Wondering about TimeZone of your CentOS Machine and want to change it? Let’s follow this small guide to check and change current TimeZone in CentOS 6 and Centos 7.

Requirements

  • Root SSH Access to CentOS Machine (Root Needed to change TimeZone)

Procedure

Check Current Date, Time and TimeZone in CentOS 6/7

  1. Check Date of your Machine which includes Time.
    date
  2. Check Current TimeZone.
    date +'%Z %z'Our Current TimeZone is CDT
    date and timezone

Change TimeZone in CentOS 6

  1. Backup current TimeZone in /root directory
    cp /etc/localtime /root/timezone.old
  2. Create Symbolic Link to your desired TimeZone
    Our desired TimeZone is IST
    ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
  3. Check Date
    date
  4. Verify TimeZone
    date +'%Z %z'change timezone

Change TimeZone in CentOS 7

  1. List all TimeZone
    timedatectl list-timezoneslist timezones
  2. List TimeZones of Asia
    timedatectl list-timezones | grep Asialist timezones asia
  3. Change TimeZone to IST
    timedatectl set-timezone Asia/Kolkata
  4. Check Date
    date
  5. Check TimeZone
    date +'%Z %z'change and check timezone