What I want to do is set a locale environment variable (LC_TIME, I think) to something which makes date output in a nice ISO format.

From looking at some other Stack Exchange questions and answers like this one, it seems I'm on the right track, and that using the en_DK locale should do what I want.

But LC_TIME=en_DK date still gives me the same date format as I had before. I also tried setting LANG and LC_ALL, and setting them to en_DK.UTF-8 too, and they have no effect. Just as a sanity check, I then tried setting all these things to ru_RU or ru_RU.UTF-8 since these would have a more obvious effect, but still no change.

I found that there's a package called language-pack-ru and installed that, and also ran sudo update-locale and sudo dpkg-reconfigure locales, but still no change. I didn't find a language-pack-dk. My /usr/share/i18n/SUPPORTED file has en_DK.UTF-8 UTF-8, en_DK.ISO-8859-15 ISO-8859-15, en_DK ISO-8859-1, so as far as I can tell I should be set.

What am I missing?


It looks like the date command without arguments outputs the locale's "date_fmt", which is not in ISO 8601 format in the en_DK locale. You can get the desired output by adding a FORMAT argument - something like:

LC_TIME=en_DK.UTF-8 date +'%x %X'

Please see man date for further FORMAT sequences.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.