How to display KDE lock screen time in 24-hour format

6,638

Mr/Ms user26687 above hit upon the correct answer in his/her comment above, but I can't mark a comment as The One True Answer, so I will summarize the content of the referenced page at kde.org.

As a bonus, that page contains instructions for changing the date format to YYYY-DD-MM, just like God, ISO and Gary Houston intended. Wasn't even asking for that, but got it anyway. Niii-i-i-i-ice.

HOW TO:

  1. Go to the directory

    /usr/share/plasma/look-and-feel/org.kde.breeze.desktop/contents/components
    

Therein you will find a file called InfoPane.qml or in 17.04 Clock.qml. Edit it as root.

  1. Find this line:

    text: Qt.formatTime(timeSource.data["Local"]["DateTime"])
    

    and change it to

    text: Qt.formatTime(timeSource.data["Local"]["DateTime"], "hh:mm:ss")
    
  2. For the ISO date change, find this line:

    text: Qt.formatDate(timeSource.data["Local"]["DateTime"], Qt.DefaultLocaleLongDate);
    

    and change it to

    text: Qt.formatDate(timeSource.data["Local"]["DateTime"], "yyyy-MM-dd");
    
  3. Save the changes.

  4. That's it! You don't even need to log out/in, much less restart anything. Hit Ctrl+Alt+L to lock your screen and see the change immediately.

Share:
6,638

Related videos on Youtube

JD Baldwin
Author by

JD Baldwin

Updated on September 18, 2022

Comments

  • JD Baldwin
    JD Baldwin almost 2 years

    Running Kubuntu with the Plasma desktop, 16.04.

    I have my desktop configured to 24-hour time, which is what I vastly prefer.

    But when the lock screen comes on, it shows me the detested AM/PM format. This cannot stand. Yet after diligent searching, I am unable to find a solution.

    Is this configurable in KDE?

  • user40171
    user40171 almost 7 years
    in Kubuntu 17.04 the file name is Clock.qml, rather than InfoPane.qml. Still works like a charm!
  • Arrant Pedant
    Arrant Pedant almost 6 years
    If I understand it correctly, the *...* is to outline the change, but should NOT be included as part of it. I updated the file exactly as shown, and seemed to break it rather badly. (A locked screen with no place to unlock it.) Had to reboot and remove the asterisks.
  • Admin
    Admin about 2 years
    Worked like a charm in Arch. Note I had to change the setting for Breeze theme even though I am using Breeze Dark; I suppose Breeze Dark must source Breeze somewhere along the line.
  • Admin
    Admin almost 2 years
    Thanks! The only drawback you need to be aware of is that updates can revert the manual changes, as I just had to experience. So it would be better if some permanent, GUI-configurable option were added for this.