How to Change Timezone, Date and Time in Linux servers

This blog post will help you change the timezone of the VPS server or dedicated server if you purchase CentOS/RHEL Linux VPS server or dedicated server from our hosting service.Let’s explore Linux change timezone, Linux date command and Linux time commands with easy examples.
You can easily change Linux date, time and timezone suitable to your working timezone.

Date Command

To see your present server date, time and time zone use below command.

# date
Mon Oct 28 18:51:12 IST 2019
Linux Timezone Config Files

CentOS stores all timezone configuration files in folder /var/share/zoneinfo/

The timezone config folder contains all timezone with their respective name. For Example: India timezone file will be located in /var/share/zoneinfo/Asia/Kolkata

/etc/localtime – This is a file which links to correct timezone file in /var/share/zoneinfo/

ls -l /etc/localtime
lrwxrwxrwx 1 root root 34 Mon 28 11:25 /etc/localtime -&gt=;../usr/share/zoneinfo/Asia/Kolkata
Linux Change Timezone

The timedatectl command is a new command utility for CentOS 7/RHEL , It’s also a replacement for old traditional Linux date command. The command output will be something like this.

# timedatectl
Local time: Mon 2019-10-28 17:16:11 IST
Universal time: Mon 2019-10-28 06:36:11 UTC
RTC time: Mon 2019-10-28 06:36:11
Time zone: Asia/Kolkata (IST, +0530)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a

You can see  date, time and timezone information clearly with timedatectl

Let’s change server timezone to another. First, we need to figure out target timezone name. The below command will show all the available timezones on the server.

# timedatectl list-timezones | less

To see all Asian countries timezone use below command.

# timedatectl list-timezones | grep Asia    

Asia/Dhaka
Asia/Dili
Asia/Dubai
Asia/Hong_Kong
Asia/Jakarta
Asia/Jayapura
Asia/Kabul
Asia/Kamchatka
Asia/Karachi
Asia/Kathmandu
Asia/Khandyga
Asia/Kolkata
Asia/Krasnoyarsk
Asia/Kuala_Lumpur
Asia/Kuching
Asia/Kuwait
Asia/Macau

To set Linux timezone to Kuwait time, the syntax and actual command will look like this

# timedatectl set-timezone time_zone    – Syntax

# datetimectl set-timezone Asia/Kuwait

Summary

We hope you learned how to change Linux/CentOS/RHEL timezones, linux time with simple commands. You can learn more from timedatectl command man pages.

Feel free to give feedback or leave a comment.