Use ISO time and date format in KDE 5

13

3

I've been using Dolphin for organising pictures. I would like to see the modification time and date displayed in ISO format. It is easier to read for me. I used to be able to configure that in KDE 4:

KDE4 time format widget

In KDE5 the widget has been replaced by this:

KDE5 time format widget

Is there a way to configure this in KDE5?

dhill

Posted 2017-01-01T14:00:20.263

Reputation: 375

On my system (Open Suse Leap 15.0) I specify ISO format in the KDE Time format settings, but Dolphin just ignores it and uses dd/mm/yyyy! Very irritating! – PJTraill – 2018-08-08T22:58:31.167

Answers

9

I find en_SE to be fully ISO-compliant: YYYY-MM-DD HH:MM (24h)

Whereas for me en_DK uses DD/MM/YYYY HH.MM (24h) which is not ISO compliant both in the date order (it's simply a western europe order) and in the time separator.

en_CA uses YYYY-MM-DD hh:MM (12h) likewise close but uses AM/PM rather than 24h.

Tested on KDE Plasma 5.11.3, running on Arch Linux.

Marco Lussetti

Posted 2017-01-01T14:00:20.263

Reputation: 106

I've been using that, and it is fine in KDE. However, the rest of the system does not have an en_SE locale, which causes problems with many programs. – Caleb Reister – 2018-04-18T19:15:25.490

The full label for en_SE is "Sweden - English (en_SE)" – EL_DON – 2018-08-22T15:59:32.283

en_DK used to work for me, but now it does the date backwards (DDMMYYYY). – EL_DON – 2018-08-22T16:01:13.433

2

I had to add en_SE manually, using the link from this comment.

Put it in /usr/share/i18n/locales/en_SE, replace "en_SE:2000" with "i18n:2012", then run sudo locale-gen

– Kael Watts-Deuchar – 2018-10-19T15:46:42.847

3Oh I also had to add en_SE.UTF-8 UTF-8 to /etc/locale.gen – Kael Watts-Deuchar – 2018-10-19T15:55:34.060

en_SE does the short format correctly, but it does d mon yyy in its long format. Austrailia (wbp_AU) uses the yyyy-mm-dd HH:MM for the short format, and yyyy Mmm d for the long format, which, while annoying, isn't as bad as writing day or month first. – EL_DON – 2020-01-03T21:50:51.603

3

No that is impossible. Is is not possible to manually set the formats like it was possible in KDE4. You always have to choose a locale for each category (Number, Time, Currency, Units, Collation)

Unfortunately installing a more standards compliant locale (like en_DK or en_NL) does not help. KDE5 uses its own list of locales, ignoring the system locales.

For the desktop clock you can set the date and time format apart from the system format in newer version of KDE 5.

Wilbert

Posted 2017-01-01T14:00:20.263

Reputation: 141

2

One locale which uses ISO 8601 timestamps is en_DK.

I'm guessing KDE 5 returned to the POSIX locale mechanism for consistency. KDE 4 was the odd one – practically all other programs use the POSIX-format locale settings, with predefined formats. (This means the settings will be understood by non-KDE programs, too.)


If KDE doesn't list en_DK, grep the output of locale -a to check whether the en_DK.utf8 item is available. If it isn't, on Debian/Ubuntu you should be able to add it via dpkg-reconfigure locales. On other distributions, if there is /etc/locale.gen, add (or uncomment) the following lines to it:

en_DK.UTF-8 UTF-8
en_DK ISO-8859-1

Run locale-gen to rebuild.


If KDE still doesn't list en_DK despite locale -a showing it, you should still be able to set it globally. The above formats correspond directly to POSIX locale environment variables:

  • Region → LANG
  • Numbers → LC_NUMERIC
  • Time → LC_TIME
  • Currency → LC_MONETARY
  • Units → LC_MEASUREMENT
  • Sorting → LC_COLLATE

The system-wide location for these varies. Often you can set them via localectl:

localectl set-locale LANG="en_US.UTF-8" LC_TIME="en_DK.UTF-8"

Sometimes you'll have to edit /etc/locale.conf, /etc/default/locale, or similar.

Per-user, the same can be set in ~/.pam_environment, ~/.profile, ~/.bash_profile, or similar.

user1686

Posted 2017-01-01T14:00:20.263

Reputation: 283 655

I cannot find en_DK on the list (it's sorted by name and the only Danish is Danish dk_DK). The widget was there since I can remember, at least KDE3. – dhill – 2017-01-02T11:55:55.023

I found that en_GB has an acceptable (day-month-year) layout. – dhill – 2017-01-03T10:38:53.973

I tried en_DK, but saw no change from en_GB. – ctrl-alt-delor – 2017-09-06T08:33:28.523

I checked, and it doesn’t use POSIX locales at all. Which can be verified by seeing that the Plasma5 UI contains elements (e.g. ksh_DE) that are not present in /usr/share/i18n/locales. A find / -iname '*ksh_de*' does not even return any results. Bad KDE. BAD. Sit! – Evi1M4chine – 2018-01-27T14:04:01.307

en_DK used to work, but now it has the date format backwards (DDMMYYYY). en_SE (Sweden - English) is currently sorted correctly (YYYYMMDD). – EL_DON – 2018-08-22T16:03:31.470

@EL_DON: My glibc 2.28 does not have en_SE at all. – user1686 – 2018-08-23T12:37:14.537

2

vi /usr/share/plasma/plasmoids/org.kde.plasma.digitalclock/contents/ui/DigitalClock.qml
- dateLabel.text = Qt.formatDate(main.currentTime, main.dateFormat);
+ dateLabel.text = Qt.formatDate(main.currentTime, "dd-MMM-yyyy");

Taken from https://www.ulduzsoft.com/2017/08/custom-date-configuration-in-kde-plasma-digital-clocks/

cetver

Posted 2017-01-01T14:00:20.263

Reputation: 143

1

I found that selecting Canada - Canadian English (en_CA) makes the short format ISO:

  • 2017-09-15 12:26 PM
  • Friday, September 15, 2017 12:25:34 PM GMT

njaard

Posted 2017-01-01T14:00:20.263

Reputation: 11

Unfortunately, speakers of other languages can not use this. – Evi1M4chine – 2018-01-27T14:07:14.370