How do I set the date format to ISO globally in Linux?

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

YYYY-MM-DD HH:MM:SS
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

#!/bin/bash
# Local multi-user startup script
export LC_TIME="en_DK"

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


Open locale.conf with your editor

# $EDITOR /etc/locale.conf

and insert the line

TIME_STYLE=iso

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.