Time zone
Jump to navigation
Jump to search
Change Server Time Zone
On cPanel Server, we can change Server Time Zone from WHM.
Step 1: Log into WHM
Step 2: Navigate to Server Time.
Step 3: Select the new TimeZone from the drodown.
Step 4: Click Save.
It is recommended to reboot the server.
MySQL time zone
By default, this will match server time. If you change the time zone for the server, mysql needs to be restarted before the new time will be seen. If you needed to set the mysql timezone directly for some reason, you can use:
Import timezone tables into mysql (IF NEEDED)
mysql_tzinfo_to_sql /usr/share/zoneinfo/|mysql -u root mysql
Set timezone in /etc/my.cnf
default_time_zone='Australia/Melbourne'
service mysql restart
PostgreSQL timezone
Check Current time:
show timezone;
Change
ALTER DATABASE DBNAME SET timezone to 'America/New_York';
Exit, re-login, and verify.
Crontab/shell timezone
Login as user via SSH:
echo 'export TZ="/usr/share/zoneinfo/America/Detroit"' >> ~/.bashrc source ~/.bashrc