Currently Thunderbird displays time in AM/PM mode.
How can I change it to 24h mode?
UPDATE 1:
$ locale |grep LC_TIME
LC_TIME="en_US.UTF-8"
Currently Thunderbird displays time in AM/PM mode.
How can I change it to 24h mode?
UPDATE 1:
$ locale |grep LC_TIME
LC_TIME="en_US.UTF-8"
Ok, solved it:
1) Make sure you have the locale you need, can't say which you specifically need but when you know you create it like this (using en_DK.utf8)
sudo locale-gen en_DK.utf8
2) To make sure this locale is in effect for thunderbird you add it to the script that starts thunderbird, so first find that script:
2a) find the right script
which thunderbird
In my case: /usr/bin/thunderbird
2b) add locale to the script (I use the editor geany):
gksudo geany /usr/bin/thunderbird
Add this in the beginning of the script (I just put at the very beginning):
LC_ALL="en_DK.utf8"
export LC_ALL
Just want to add this:
https://help.ubuntu.com/community/Locale
EDIT: as pointed out by pl1nk A better solution would be to NOT touch the /usr/bin/thunderbird script and instead create the script '/usr/local/bin/thunderbird' with this content
#!/bin/sh
LC_ALL="en_DK.utf8"
export LC_ALL
/usr/bin/thunderbird $@
make sure it's executable
sudo chmod a+x /usr/local/bin/thunderbird
Then check if it's being used to start thunderbird:
which thunderbird
should respond with this:
/usr/local/bin/thunderbird
Now thunderbird can be started as before.
LC_TIME
or LC_ALL
no longer helps. I can see in less /proc/$(pidof thunderbird)/environ
on Linux that the env var is set correctly, but it seems to be ignored.
– nh2
Dec 23 '17 at 02:18
env LC_TIME=sv_SE.UTF-8 thunderbird
looks promising as I use only the short date format and not the long date format.
Nice summary comment to above-linked bug report - https://bugzilla.mozilla.org/show_bug.cgi?id=1426907#c138
– Randall Whitman
Jul 08 '19 at 23:26
The way dates and times are formatted in Thunderbird 60 has changed. The following will provide a date/time format that will look like this: 2018-12-04 14:23
:
Create the root locale
sudo ln -s /usr/share/i18n/locales/en_DK /usr/share/i18n/locales/root
sudo sh -c "echo 'root.UTF-8 UTF-8' > /var/lib/locales/supported.d/local"
sudo locale-gen
Copy the Thunderbird launcher locally
cp /usr/share/applications/thunderbird.desktop ~/.local/share/applications/
Change the date/time locale for Thunderbird
sed -i.bak 's/^Exec=thunderbird %u/Exec=env LC_TIME=root.utf8 thunderbird %u/' ~/.local/share/applications/thunderbird.desktop
Fsando's answer works, but LC_ALL will change the entire locale (date, number, currency format, etc) used by Thunderbird instead of just the date/time format, which is all that's asked for in the question. Not only that, but I don't like creating extra scripts if I don't have to. Here's what I did:
Make sure the en_DK.utf8 locale is available (it should already be available if your desktop language is English):
locale -a | grep en_DK
If it's not, install the locale, the official way:
sudo apt-get -y install language-pack-en
Or if you don't feel like installing extra packages:
sudo locale-gen en_DK.utf8
Copy the Thunderbird launcher locally
cp /usr/share/applications/thunderbird.desktop ~/.local/share/applications/
Change just the date/time locale for Thunderbird
sed -i.bak 's/^Exec=thunderbird %u/Exec=env LC_TIME=en_DK.utf8 thunderbird %u/' ~/.local/share/applications/thunderbird.desktop
If you're using Xfce the change is picked up right away, but if you're using Unity you may have to log out/log back in. Not sure about GNOME.
Next time you open Thunderbird from your launcher, it should use the new date/time format.
Advantages:
And as a bonus, the change shouldn't get overwritten when the thunderbird package gets updated, because it won't touch your local launcher file.
Source:
http://kb.mozillazine.org/Date_display_format
Note: As Sparhawk mentions, LC_TIME will change date format as well as time format. However, you can find a locale with the same date format and different time format, and thereby change only the time format.
For example, this is what the en_US.utf8
locale looks like:
$ python3 -c "import locale, time; locale.setlocale(locale.LC_TIME, 'en_US.utf8'); print(time.strftime('%x %X'))"
12/05/2018 03:40:50 PM
Changing the locale to en_DK.utf8
will change the date format too:
$ python3 -c "import locale, time; locale.setlocale(locale.LC_TIME, 'en_DK.utf8'); print(time.strftime('%x %X'))"
2018-12-05 15:41:14
en_US.UTF8
and en_GB.UTF8
. i.e. the former is MM/DD/YY and the latter is DD/MM/YY. This might make a difference in Thunderbird?
– Sparhawk
Mar 01 '15 at 21:13
LC_TIME=en_DK.utf8 thunderbird
I run my system as en_US.UTF-8 too, just in case....
en_DK
stopped working for newer Thunderbird versions, but env LC_TIME=sv_SE.UTF-8 thunderbird
will work OK (unless using "long" date format).
– Randall Whitman
Jul 08 '19 at 23:33
I just added LC_TIME=en_DK.UTF-8
to /etc/default/locale
. Works fine on Linux Mint 17.3, should work in Ubuntu too.
1) open /etc/default/locale
in your editor. The content of the file should look something like this:
LANG="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
2) add LC_TIME=en_DK.UTF-8
. If LC_TIME=
is already there, change its value to en_DK.UTF-8
.
3) Save and restart OS.
/etc/default/locale
is not thunderbird specific. If you change the format there it will probably apply to other applications as well.
In Ubuntu 18.04 and later (and probably other Gnome-based distros), date format is controlled by Gnome for each user. Open Terminal
and type:
gsettings set org.gnome.desktop.interface clock-format '24h'
Then restart Thunderbird.
Credit: a comment from PRATAP on a related question How to set date format from 12 hour to 24 hour at the command line
There is a simple solution for the time and date format issues - a newer plugin works for Thunderbird 60+ that allows full customization of the time and date formats. It's called "Enhanced Date Formatter" and is in the list of extensions inside Thunderbird. Just fire up Thunderbird and search for it, install it, and customize however you want.