ubuntu设置时间显示为24小时制
对ubuntu默认的时间显示格式不太满意,查阅了相关资料进行修改为24小时制度,特此记录和分享给需要设置的网友
查看当前的timezone
root@jumpserver:~# timedatectl
Local time: Sat 2024-03-23 12:45:53 UTC
Universal time: Sat 2024-03-23 12:45:53 UTC
RTC time: Sat 2024-03-23 12:45:53
Time zone: Etc/UTC (UTC, +0000)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
root@jumpserver:~#
列举可选的timezons
root@jumpserver:~# list-timezones
设置时区为上海
root@jumpserver:~# timedatectl set-timezone "Asia/Shanghai"
root@jumpserver:~#
设置时间为24小时制
- 设置完成后,需要退出SSH重新登录才会生效
root@jumpserver:~# echo "LC_TIME=en_DK.UTF-8" >>/etc/default/locale
查看设置完成后的状态
ubuntu@jumpserver:~$ date
Sat Mar 23 21:00:24 CST 2024
ubuntu@jumpserver:~$ timedatectl
Local time: Sat 2024-03-23 21:00:39 CST
Universal time: Sat 2024-03-23 13:00:39 UTC
RTC time: Sat 2024-03-23 13:00:39
Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no