I would like to globally set the Linux date format to ISO, which looks roughly like this:

2009-03-16 15:20:00

With varying levels of detail, such as omitting time, seconds, etc.

I know that for some applications, you can configure this manually, but I'd like it to be automatically set for every program.

I'm specifically using Ubuntu Intrepid, but a general solution that would work across all distributions would be best.


Set your locale date environment variable LC_TIME to "en_DK" Set it in your .bashrc or similar, or check man locale for how to set it system-wide.

On ArchLinux all of the Locale settings are in /etc/rc.conf and customisations are set up in /etc/rc.local

# Local multi-user startup script
export LC_TIME="en_DK"
  • 2
    I found that nowadays (Ubuntu 12.04) you need to set it to "en_DK.UTF8", but otherwise, great to know that Danish folks use sane ISO date format ;-). – pfalcon Aug 24 '13 at 19:22
  • 3
    @pfalcon it is not "english in Denmark" as the abbreviations would make one believe, it is mock, which name is a joke that is lost to me... see the references from this freebsd bug, which unfortunately decided not to adopt it: freebsd.org/cgi/query-pr.cgi?pr=137870 that said, it may be very well that in Denmark everyone uses the ISO date formate tho. – gcb Feb 12 '14 at 8:28
  • @gcb: So should we use en_DK or not? – einpoklum Mar 22 '17 at 14:29
  • 4
    @einpoklum It's a workaround for English speaking countries, There is no ISO format for weekday names. The discussion on this bug for glibc is quite informative (You have to read past Ulrich Drepper being angry): sourceware.org/bugzilla/show_bug.cgi?id=4628 – Sekenre Mar 27 '17 at 10:20
  • If en_DK is no good, try en_SE if your system has it. You should append .UTF-8 to the value if your existing locale has that suffix in the output of the locale command. – Walf Aug 11 '20 at 7:21

It's explained at length in this guide: http://ccollins.wordpress.com/2009/01/06/how-to-change-date-formats-on-ubuntu/

  • I went and found the link since prestiginate said he couldn't post hyperlinks. And I actually had been there before, but I guess I never bothered doing it on this machine, making me think whatever I tried before didn't work. – Neil Jun 1 '09 at 21:18
  • If anyone wants the Unicode string for ISO dates, it's <U002b><U0025><U0059><U002d><U0025><U004d><U002d><U0025><U0064>. The python line that makes this is: ''.join(['<U00{}>'.format(hex(b)[-2:]) for b in '+%Y-%M-%d'.encode('UTF-8')]) – partofthething Dec 16 '17 at 17:18

Open locale.conf with your editor

# $EDITOR /etc/locale.conf

and insert the line


after saving the file run

# locale-gen
# env-update && source /etc/profile

and test the result

# ls -al /home
drwxr-xr-x   8 root             root      4096 2011-12-2  .

Some people would advise to change your local to german "en_DK" this kind of works if you don't mind the day and month names being in german. Since I cannot post hyperlinks,and this board sees my linux commands as hyperlinks.... (nice one)... I can only say you search (google) how-to-change-date-formats-on-ubuntu and click the first link.

  • 1
    He meant this link: ccollins.wordpress.com/2009/01/06/… – Neil Jun 1 '09 at 21:16
  • 4
    en_DK is not the German locale either, it's danish. – GodEater Jun 2 '09 at 7:08
  • 1
    it is neither. "en" is English. the "DK" part is the country which sets things like currency symbols, date formats and decimal separators, etc. The first part is the language, which would determine month names. – gcb Feb 12 '14 at 8:30

Probably the best way to do this, but not break things is to follow the walkthrough at


  • 2
    Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Jenny D Dec 29 '17 at 20:19

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.