标签搜索

RockyLinux9.3中,默认时间格式为12小时制,调整为24小时制

lilymaxyz
2025-05-04 / 0 评论 / 6 阅读 / 正在检测是否收录...

案例一:在 RockyLinux 9.3 中,默认时间格式为 12 小时制,调整为 24 小时制

官网: https://www.rockylinux.cn/notes/rocky-linux-9-pei-zhi-shi-jian-tong-bu-fu-wu-chrony.html

# 当前时间显示格式
[root@openEuler-14 ~]# date
Sun May  4 07:55:42 PM CST 2025
[root@openEuler-14 ~]# localectl
System Locale: LANG=en_US.UTF-8
    VC Keymap: us
   X11 Layout: us


# 设置时间本地化格式显示
[root@openEuler-14 ~]#localectl set-locale LC_TIME=C.UTF-8


# 验证是否设置成功
[root@openEuler-14 ~]# localectl
System Locale: LANG=en_US.UTF-8
               LC_TIME=C.UTF-8
    VC Keymap: us
   X11 Layout: us


# 退出登录
[root@openEuler-14 ~]# exit
logout


# 重新登录查看时间,已经修改为 24 小时制
[root@openEuler-14 ~]# date
Sun May  4 19:56:42 CST 2025

案例二:时间显示英文调整为中文

# 当前时间格式为英文
[root@ntp-client ~]# date
Wed May 22 16:24:20 CST 2024
[root@ntp-client ~]# cat /etc/locale.conf 
LANG="C.UTF-8"

 
# 安装中文语言包
[root@ntp-client ~]# dnf install -y langpacks-zh_CN
# 确保中文语言包安装成功
[root@ntp-client ~]# locale -a | grep zh_CN
zh_CN
zh_CN.gb18030
zh_CN.gbk
zh_CN.utf8

 
# 修改语言为 zh_CN.utf8
[root@ntp-client ~]# localectl set-locale LANG=zh_CN.utf8
# 验证是否设置成功
[root@ntp-client ~]# cat /etc/locale.conf 
LANG=zh_CN.utf8

 
# 设置时间本地化格式显示
[root@ntp-client ~]# localectl set-locale LC_TIME=zh_CN.UTF-8
# 验证是否设置成功
[root@ntp-client ~]# localectl
System Locale: LANG=zh_CN.utf8
               LC_TIME=zh_CN.UTF-8
    VC Keymap: cn
   X11 Layout: cn

 
# 退出登录
[root@ntp-client ~]# exit
logout

 
# 重新登录查看时间,已经为中文格式显示。
[root@ntp-client ~]# date
2024年 05月 22日 星期三 17:54:32 CST

endl

0

评论

博主关闭了所有页面的评论