SommitRealWeird

GNU date...

Hmmm, MJ Ray asks about date and locales...

I think (though without grabbing the source I can't confirm) that the default date format of "date" is the legacy format that it's always been... if you want to get a shiny locale based date format from it use, +"%c". Here's the output from my laptop:

brettp@pitr:~$ locale
LANG=en_GB.UTF-8
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME=en_GB.UTF-8
LC_COLLATE="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_PAPER="en_GB.UTF-8"
LC_NAME="en_GB.UTF-8"
LC_ADDRESS="en_GB.UTF-8"
LC_TELEPHONE="en_GB.UTF-8"
LC_MEASUREMENT="en_GB.UTF-8"
LC_IDENTIFICATION="en_GB.UTF-8"
LC_ALL=
brettp@pitr:~$ date
Wed Jan 18 08:34:52 GMT 2006
brettp@pitr:~$ date +"%c"
Wed 18 Jan 2006 08:34:55 GMT
brettp@pitr:~$

I wonder why date doesn't use "%c" by default... weird.

Posted: 2006-01-18 08:31 in Tech | permalink