# How to change the time from 12 hours to 24 hours?

**URL:** https://forums.rockylinux.org/t/how-to-change-the-time-from-12-hours-to-24-hours/16309
**Category:** Rocky Linux Help & Support
**Tags:** rocky-linux-9
**Created:** [October 22, 2024, 7:51pm UTC](https://forums.rockylinux.org/t/how-to-change-the-time-from-12-hours-to-24-hours/16309 "2024-10-22T19:51:45Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![etpi](https://avatars.discourse-cdn.com/v4/letter/e/8e8cbc/32.png) [@etpi](https://forums.rockylinux.org/u/etpi)
#### Post date: [October 22, 2024, 7:51pm UTC](https://forums.rockylinux.org/t/how-to-change-the-time-from-12-hours-to-24-hours/16309/1 "2024-10-22T19:51:45Z")

</div>

OS: Rocky Linux 9  
user: root

Guys, I need some very simple help.  
I need to change the time zone of Rocky Linux 9 by 24 hours instead of 12 hours. How do I change it to 24 hours?

I tried several commands and nothing worked.

I did some tests but I was unsuccessful.

command:  
sudo localectl set-locale LC\_TIME=C.utf8

timedatectl status  
Local time: Tue 2024-10-22 16:49:03 -03  
Universal time: Tue 2024-10-22 19:49:03 UTC  
RTC time: Tue 2024-10-22 16:49:03  
Time zone: America/Sao\_Paulo (-03, -0300)  
System clock synchronized: yes  
NTP service: active  
RTC in local TZ: yes

---

<div class="post-metadata">

### Author: ![jlehtone](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jlehtone](https://forums.rockylinux.org/u/jlehtone)
#### Post date: [October 23, 2024, 11:47am UTC](https://forums.rockylinux.org/t/how-to-change-the-time-from-12-hours-to-24-hours/16309/2 "2024-10-23T11:47:31Z")

</div>

Are you talking about time format, as displayed? E.g. 18:45 vs 6:45pm

Displayed by whom?

- GNOME GUI? `Settings / Date & Time` has Time Format options “24-hour” and “AM / PM”.
- Terminal, `ls`? The `man ls` and `info '(coreutils) ls invocation'` do mention that format may use info from timezone and or locale. They also mention environment variables `TIME_STYLE` and `LC_TIME`.

---

<div class="post-metadata">

### Author: ![etpi](https://avatars.discourse-cdn.com/v4/letter/e/8e8cbc/32.png) [@etpi](https://forums.rockylinux.org/u/etpi)
#### Post date: [October 23, 2024, 5:24pm UTC](https://forums.rockylinux.org/t/how-to-change-the-time-from-12-hours-to-24-hours/16309/3 "2024-10-23T17:24:39Z")

</div>

I managed to solve it, I ran some commands and after a few minutes it went back to normal.

Check:

- date
- timedatectl status
- localectl
- ls /usr/lib/locale/

Commands:  
_sudo localectl set-locale LC\_TIME=C.utf8_

And after a few minutes the time updated to 24 hours, ok!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/1X/91b7219eec10e30013422e4df76c1d898711a5d5.svg) [@system](https://forums.rockylinux.org/u/system)
#### Post date: [December 22, 2024, 5:25pm UTC](https://forums.rockylinux.org/t/how-to-change-the-time-from-12-hours-to-24-hours/16309/4 "2024-12-22T17:25:25Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
