Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 6 down vote accepted

It's explained at length in this guide:

share|improve this answer
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

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"
share|improve this answer
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
@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: that said, it may be very well that in Denmark everyone uses the ISO date formate tho. – gcb Feb 12 '14 at 8:28

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.

share|improve this answer
He meant this link:… – Neil Jun 1 '09 at 21:16
en_DK is not the German locale either, it's danish. – GodEater Jun 2 '09 at 7:08
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

share|improve this answer

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  .
share|improve this answer
What distro is that? On Ubuntu, for example, that file doesn't even exist. – 0xC0000022L May 17 '15 at 21:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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