How to change timezone in Linux
Linux instances are set to the UTC (Coordinated Universal Time) time zone by default.
But we need to change the time to local timezone for better understanding of time in log or in other file. First of all check timezone in linux server.
# date
Sat Aug 19 06:58:34 UTC 2017
Above command show time date with timezone UTC. Now we can change it to Indian time std.
Step 1: List all zone info by the command
# ls /usr/share/zoneinfo
Above command show zoneinfo. Some are directory and some are file. We require to set indian time zone so search kolkata timezone in Asia directory. So complete path for my timezone is /usr/share/zoneinfo/Asia/kolkata.
Step 2 : Update the /etc/sysconfig/clock file with the new time zone.
# vim /etc/sysconfig/clock
Change entry according to your timezone
Note: Do not change UTC=true. This entry is for hardware clock.
Save file and exit
Create a symbolic link between /etc/localtime/
# ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
Above command create link of your time zone for system local timezone information.
Now check your time by date command
date
Sat Aug 19 12:49:29 IST 2017
It show your indian time zone ( IST )
Step 4 : Reboot your system for reflecting this time zone in all your applications.
$ sudo reboot
reference: