how to change server time in cyberpanel

how to change server time in cyberpanel

1 Like

Decide on timezone

command replace “America/Detroit” with your Timezone
echo “Before: $(date)” && export TZ=“/usr/share/zoneinfo/America/Detroit” && echo ‘export TZ=“/usr/share/zoneinfo/America/Detroit”’ >> ~/.bashrc && echo “After: $(date)”

[root@wcloud ~]# echo “Before: $(date)” && export TZ=“/usr/share/zoneinfo/America/Detroit” && echo ‘export TZ=“/usr/share/zoneinfo/America/Detroit”’ >> ~/.bashrc && echo “After: $(date)”
Before: Thu Sep 19 07:57:32 UTC 2019
After: Thu Sep 19 03:57:32 EDT 2019
[root@wcloud ~]#

The simple answer:

To see current timezone:

timedatectl

To list all possible timezones:

timedatectl list-timezones

To set your specific timezone:

timedatectl set-timezone America/Sao_Paulo

To verify if the changes were applied:

timedatectl

Then:

reboot

3 Likes

Type your comment> @webmasterpm said:

The simple answer:

To see current timezone:

timedatectl

To list all possible timezones:

timedatectl list-timezones

To set your specific timezone:

timedatectl set-timezone America/Sao_Paulo

To verify if the changes were applied:

timedatectl

Then:

reboot

I got the output this:
Local time: Tue 2021-06-01 20:40:00 HKT
Universal time: Tue 2021-06-01 12:40:00 UTC
RTC time: Tue 2021-06-01 12:40:01
Time zone: Asia/Hong_Kong (HKT, +0800)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no

The Cyberpanel backup file name still in UTC, not UTC+8. How can I fix it to UTC+8 ?

1 Like

Hi All.

I also have a time zone issue

My server says Local time in Istanbul is 19:16 however in reality it’s 22:16. How I can fix this issue?

[root@ns1 ~]# timedatectl
      Local time: Thu 2022-03-31 19:16:41 +03
  Universal time: Thu 2022-03-31 16:16:41 UTC
        RTC time: Thu 2022-03-31 16:16:42
       Time zone: Europe/Istanbul (+03, +0300)
     NTP enabled: n/a
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a

Thanks in advance.

Hi,

Fixed it. The server was showing UTC time wrong. Had to run NTP synchronization in SSH.

yum install ntp

sudo ntpd -gq

sudo timedatectl set-timezone Europe/Istanbul

3 Likes