Một số trường hợp khi máy chủ server/vps của bạn thời gian bị sai, timezone không chính xác gây ảnh hưởng đến việc đồng bộ thông tin hoặc các tác vụ mà bạn set lịch trong đó. Và bài viết này sẽ hướng dẫn bạn thay đổi Timezone trên máy chủ Centos.
# timedatectl
Bên dưới cho thấy múi giờ của hệ thống được đặt America/New_York (EST, -0500)
Local time: Tue 2019-12-17 21:42:07 EST
Universal time: Wed 2019-12-18 02:42:07 UTC
RTC time: Wed 2019-12-18 02:42:06
Time zone: America/New_York (EST, -0500)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: no
Last DST change: DST ended at
Sun 2019-11-03 01:59:59 EDT
Sun 2019-11-03 01:00:00 EST
Next DST change: DST begins (the clock jumps one hour forward) at
Sun 2020-03-08 01:59:59 EST
Sun 2020-03-08 03:00:00 EDT# ls -l /etc/localtime
Output lrwxrwxrwx. 1 root root 38 Mar 21 2018 /etc/localtime -> ../usr/share/zoneinfo/America/New_York
# timedatectl list-timezones
Output ... America/Tijuana America/Toronto America/Tortola America/Vancouver America/Whitehorse America/Winnipeg ... Asia/Ho_Chi_Minh ...
# timedatectl set-timezone your_time_zone
# timedatectl
Output
Local time: Wed 2019-12-18 09:45:01 +07
Universal time: Wed 2019-12-18 02:45:01 UTC
RTC time: Wed 2019-12-18 02:45:01
Time zone: Asia/Ho_Chi_Minh (+07, +0700)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
Chia sẻ