Friday, April 26, 2024

Change Timezone

To find list of all available time zones, run:
[root@localhost ~]# timedatectl list-timezones
The syntax is as follows to set timezone and need to run as root user:
[root@localhost ~]# timedatectl set-timezone time_zone
In this example, set timezone to America/Chicago
[root@localhost ~]# timedatectl set-timezone America/Chicago
Verify new settings by typing the following two commands:
[root@localhost ~]# date
Sun Jun 18 15:25:03 CDT 2017
[root@localhost ~]# ls -l /etc/localtime 
lrwxrwxrwx 1 root root 37 Jun 18 15:24 /etc/localtime -> ../usr/share/zoneinfo/America/Chicago
[root@localhost ~]#
Change the TimeZone setting on /var/lib/pgsql/data/postgresql.conf to the value you want:
log_timezone = 'America/Chicago'
timezone = 'America/Chicago'
After that you need to restart the service:
[root@localhost ~]# systemctl restart postgresql