Quoting Clive Standbridge on 2010-01-16 15:31:19:
> How about
> date -I
> date -Iseconds
>
> Sortable, readable, parseable and standard to boot.
Wow, thanks for that Clive. Easier to remember, too. I just tried it in
a shell one-liner, and I used a bit less logic to parse it than other
methods I've tried in the past.
The below is for the benefit of those who are just joining this thread:
For programs that expect strftime(3) format [1] this is equivalent to
-Iseconds (which isn't even documented in date(1)'s manpage in Lenny)
date +'%FT%T%z' # the part in single quotes is passed straight to
# strftime(3) if I believe, someone correct me if
# I'm wrong, please.
A simple '%F' is equivalent to 'date -I'.
[1] such as Irssi's or xchat's log format specifiers, various syslogd
implementations (IIRC)...
--
_
ASCII Ribbon Campaign Against ( ) Brian Ryans
HTML E-mail and V-cards X BrianLRyans@gmail.com
www.asciiribbon.org / \ GPG Public Key 0xC11213D0
Key Fingerprint: 8B2A 54C4 E275 8CFD 8A7D 5D0B 0AD0 B014 C112 13D0
Attachment:
signature.asc
Description: Digital signature