1.解决欧拉系统date显示12小时制问题
1.1查看默认的时间显示格式
[root@xx xx]# date
Mon Sep 23 02:45:01 PM CST 2024
1.2修改为24小时制
1.2.1 编辑/etc/profile文件
执行vi /etc/profile
命令在文件末行增加export LC_TIME=POSIX
,修改完后保存退出。
1.2.2 使配置生效
执行如下命令:
[root@xx ~]# source /etc/profile
1.2.3 检查时间显示格式
[root@xxx xxx]# date
Mon Sep 23 14:51:53 CST 2024
2.时区调整
2.1 查看当前时区
[root@openeuler xxx]# timedatectl status
Local time: Tue 2024-09-24 15:12:20 CST
Universal time: Tue 2024-09-24 07:12:20 UTC
RTC time: Tue 2024-09-24 07:12:20
Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
2.2 更改时区
sudo timedatectl set-timezone Asia/Shanghai
2.3 确认更改
[root@openeuler xxx]# timedatectl status
Local time: Tue 2024-09-24 15:18:13 CST
Universal time: Tue 2024-09-24 07:18:13 UTC
RTC time: Tue 2024-09-24 07:18:13
Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
[root@openeuler xxx]# date
Tue Sep 24 03:18:15 PM CST 2024