Linux: How to adjust server time to local time?

scene description

The project deployed on the server uses the time module (such as: scheduled tasks, logs, update time, etc.), at this time, it is found that the time (UTC) on the server is inconsistent with the local time (UTC+8), so how to set the time on the server How about adjusting the time to local time?
time

solution

Option One

Enter the following command on the server

timedatectl set-timezone Asia/Shanghai

dateYou can check the current time zone with the command

  • Before changing the time zone
    Before changing the time zone
  • After changing the time zone
    After changing the time zone

Option II

For Pagoda users, you can download and install the " Linux Toolbox " in the " Software Store " , then open the " Linux Toolbox ", select " Time Zone Settings ", and finally set the time zone to " Asia/Shanghai ".
icon

Guess you like

Origin blog.csdn.net/qq_34562959/article/details/121375168