Use ISO 8601 dates in PCManFM on Debian LXQt

I like ISO 8601 or RFC 3339 style dates.  That is, rather than "January 15, 2021", I like "2021-01-15".

This is especially useful in a file manager, having all the year-month-day lined up vertically in a column.

I also prefer 24-hr time format for the same reason.  But how to set this up?


macOS Finder

For Mac's file manager, it's really easy to set the date/time format:

Just open System Preferences > Language & Region > Advanced > Dates, then modify the date formats to whatever you want.  At the same time, you could go to the Times tab and set it to use 24-hr format. 

Done!  I offer this as just a point of comparison for what's below...

Debian LXQt PCManFM

On LXQt's PCManFM file manager, running on Debian, the setup was... annoyingly difficult.

PCManFM does not allow custom date/time formatting.  It only respects the system set locale.  So you have to choose the right locale.

Step 1.1: Select Locale

On LXQt, you can easily set the locale (they call it "Region") by running lxqt-config-locale in the terminal, or else click the system Preferences > LXQt settings > Locale.

Step 1.2: Which locale to choose???

You have a number of options.

Do you want:

  • English language
  • dollar denominated
  • metric
  • ISO-8601
  • but 12-hr time?

Use Canadian English (en_CA) locale.

If that's not close enough, and you really want 24-hr time as well, you can enable Detailed Settings and change the Time locale to Sweden - English (en_SE).

Be sure to see Step 2: Installing Locales in Debian, because chances are doing the above will cause system errors later!

Note that en_CA uses Canadian dollars, not USD!  You can change the Currency locale to American English (en_US) if you want real USD dollars.  Although it probably doesn't matter for formatting purposes.

Why Sweden?  It turns out lots of Europeans want something similar, as in a locale that is English language, metric, using ISO-8601 or similar style dates!

Sweden - English is an unofficial locale made up to give us that [1], but it does use Swedish kronor SEK for currency [2].  That's why you only want to set the Time locale to use en_SE, keeping the rest as en_CA (or en_US).


Step 2: Installing Locales in Debian

Selecting the "Region" in LXQt's locale preference app is just half the story.

PCManFM will probably work fine as is.  Qt apps are fine because it uses it's own Qt locale definition lookup system, and includes en_CA and en_SE by default.

Debian does not include en_CA by default, so you'll have to install it.  And it does not have en_SE... not at all... you'll have to add the en_SE definition file manually then install it.

You can download a copy of the en_SE locale definition written by Mikael Auno [7].  Then create this directory if it doesn't exist:


Place the en_SE file into the above locales directory.  Create a text file in the above i18n directory containing this text:

en_SE.UTF-8 UTF-8

Then run in terminal:

$ sudo dpkg-reconfigure locales

You should see a list of locales you can install.  Look for and install the ones you selected in LXQt's locale preference app.  For my example above, that means en_CA, en_US, and en_SE.

Lastly, logout and re-login for the changes to take effect.


Fully Custom Locales in Debian: don't bother

From above, you see Debian allows you to create totally custom locales, so you can customize all the formats the way Macs can!  After all, that en_SE locale file you downloaded was just made up so to speak, and you can customize it however you want.

...but Qt won't use it.  Qt's locale system runs parallel to Debian Linux's.

So why go through the trouble of installing the en_SE locale if Qt won't use it?  Because if you don't, you'll run into problems with non-Qt apps, problems like:

Run locale in the terminal, and it'll complain:

locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

Unzip certain archives using file-roller results in a dialog box complaining:

An error occurred while extracting files.
Pathname can't be converted from UTF-8 to current locale.

That occurs because a locale you chose in LXQt was not installed in Debian [8].  Qt is perfectly happy though, as it runs a separate locale system...


Firefox locale incompatibility

If you set your locale to Canadian or US English (en_CA or en_US), and enabled Detailed Settings to change the Time locale to Sweden - English (en_SE), Firefox will show numbers in Swedish / European style, like "3,14" instead of "3.14".

This problem happens at least in the downloads window.

Method 1: Fix by setting LC_ALL environment variable

The most reliable way to fix it in Debian is to set the LC_ALL environment variable, but only for Firefox [13].  Don't set LC_ALL globally or it'll undo the locale changes above, plus you just shouldn't as it overrides everything [12]. 

For the terminal :

With that said, all it involves is opening Firefox in the terminal like this:

LC_ALL=en_CA.utf8 firefox

You can save that in a script that's in your PATH so running Firefox always uses the LC_ALL locale.

For the Firefox icon:

The Firefox icon in Debian requires a different fix though.  That icon in the applications menu is controlled by a  firefox.desktop file located at:


You can modify it directly or, safer, copy it to your user's applications folder:


Once copied, open it in a plaintext editor and change the Exec line to this:

Exec=sh -c "LC_ALL=en_CA.utf8 /usr/bin/firefox"


Method 2: Fix by setting Firefox locale internally

The "official" way to set the Firefox user interface locale is via Firefox's preferences [14]:  open preferences, then go to the Language section of the General panel.

I've tried it on Debian and it doesn't work.

You could also try finding in about:config the intl.locale.requested key and set it to the desired locale [15].  I didn't test this method though because setting the LC_ALL environment variable worked perfectly for me.

Other locale options

Sweden - English (en_SE) is an unofficial locale made up to give us English language, metric, ISO-8601 date format [1].  But it uses Swedish kronor SEK for currency [2].

Denmark - English (en_DK) is another unofficial locale made up with similar English and metric formats [3].  But the date is backwards (in dd/MM/y format), and uses Danish kroner DKK currency [4].

Ireland - English (en_IE) is an official locale that, like Denmark - English, gives us English and metric units [5], and like en_DK, the date is backwards (in dd/MM/y format).  It uses Euro for currency [6] though.

So by mixing and matching Ireland, Denmark, and Sweden, you should be able to get a reasonable ISO 8601/English/Euro(pean) locale.

And mixing Canada, US, and Sweden will get you a reasonable ISO 8601/English/Dollar locale.


[1]: https://unix.stackexchange.com/a/62318

[2]: https://icu4c-demos.unicode.org/icu-bin/locexp?d_=en&_=en_SE

[3]: https://unix.stackexchange.com/a/272665 and https://superuser.com/a/1269909

[4]: https://icu4c-demos.unicode.org/icu-bin/locexp?d_=en&_=en_DK

[5]: https://unix.stackexchange.com/a/62317

[6]: https://icu4c-demos.unicode.org/icu-bin/locexp?d_=en&_=en_IE

[7]: https://bugs.launchpad.net/ubuntu/+source/langpack-locales/+bug/208548/comments/11

[8]: https://unix.stackexchange.com/a/269293

[12]: https://wiki.debian.org/Locale#Configuration 

[13]: https://unix.stackexchange.com/questions/34965/how-to-change-firefox-language#comment47453_34967

[14]: https://support.mozilla.org/en-US/kb/use-firefox-another-language?redirectslug=use-firefox-interface-other-languages-language-pack&redirectlocale=en-US#w_how-to-change-the-language-of-the-user-interface

[15]: https://support.mozilla.org/en-US/questions/1223719#answer-1127761


[9]: https://github.com/lxqt/pcmanfm-qt/issues/656

[10]: https://github.com/lxqt/lxqt-config/issues/507

[11]: https://wiki.debian.org/Locale

No comments: