Wednesday, January 12, 2011

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"
    
    From
  • 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.

    Neil : He meant this link: http://ccollins.wordpress.com/2009/01/06/how-to-change-date-formats-on-ubuntu/
    GodEater : en_DK is not the German locale either, it's danish.
    From
  • Probably the best way to do this, but not break things is to follow the walkthrough at

    http://ccollins.wordpress.com/2009/01/06/how-to-change-date-formats-on-ubuntu/

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

    Neil : 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.
    From Neil

0 comments:

Post a Comment