[ChatGPT Programming Notes] Solve the 8-hour difference between Linux server time and Beijing time

If the time difference between your Linux server and Beijing time is 8 hours, you can try the following methods to fix it:

 

  1. View the time zone setting of the current Linux server:

    timedatectl
    

    Time zone If not  in the output  Asia/Shanghai, the Linux server's time zone is not set correctly.

  2. Modify the time zone setting of the Linux server:

    sudo timedatectl set-timezone Asia/Shanghai
    

    Set the time zone to Dongba District (Beijing time).

  3. Verify that the time zone setting is in effect:

    timedatectl
    

    Time zone If yes  in the output  Asia/Shanghai, it means that the time zone setting has taken effect, and the time of the Linux server should be the same as Beijing time.

  4. If the time zone is already set correctly, but the time is still incorrect, you can try to set the time manually:

    sudo date -s "2022-01-01 00:00:00"
    

    Set the time to the correct time.

 

Guess you like

Origin blog.csdn.net/qq_39154376/article/details/130839178