The company's new project uses the Ubuntu system. After testing the program, it is found that the results are different from those of the local operation. After checking the logs, it is found that the log time is incorrect. It is 8 hours different from the current time, and the time is still in 12-hour format. By modifying the time zone and changing the 24-hour format Solve the problem perfectly.
1. Check the time
View the current time of the system
date -R
2. Modify the time zone
Modify the time zone to Shanghai, China time zone
timedatectl set-timezone Asia/Shanghai
3. Update time
date -s "2023-09-05 23:30:00"
4. Write time to hardware
hwclock -w
5. Modify the 24-hour format
Modify the file and add a line LC_TIME=en_DK.UTF-8 at the bottom
vim /etc/default/locale