[linux-elitists] Show Us The Code

Rick Moen rick@linuxmafia.com
Thu Mar 1 11:53:17 PST 2007


Quoting Matthew Galgoci (mgalgoci@redhat.com):
> Michael Dominok <ml.linux-elitists@dominok.net> wrote:
>
> > Oi. Where does that come from? A hidden feature of date? Can't find it
> > in the man-page. But it works. Thanks.
> 
> It's in the man page. Search the man page for FORMAT in all caps.

Maddeningly, it's correctly (if somewhat obscurely) documented in some
distros' manpages, but not others.  In RHEL (sure, take a bow), one sees
this:


DESCRIPTION
       Display the current time in the given FORMAT, or set the system date.
[...]

       -ITIMESPEC, --iso-8601[=TIMESPEC]
              output  date/time  in ISO 8601 format.  TIMESPEC=`date' for date
              only, `hours', `minutes', or `seconds' for date and time to  the
              indicated  precision.   --iso-8601  without TIMESPEC defaults to
              `date'.


Debian 4.0 "etch" lacks that detail (in "man 1 date", anyway -- and also in
the related info docs on GNU coreutils).  In the same stretch of
manpage on "etch", only this appears:


DESCRIPTION
       Display the current time in the given FORMAT, or set the system date.
[...]

       --rfc-3339=TIMESPEC
              output date and time in RFC 3339 format.  TIMESPEC=`date', `sec-
              onds', or `ns' for date and time to the indicated precision.


(RFC 3339 defines a "a profile of ISO 8601 for use in Internet protocols".)


Anyway, I went around using "date --iso-8601" in bash scripts for years
before someone pointed out to me that "date -I" does the same thing.




More information about the linux-elitists mailing list