bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XML-like date/time support ?


From: Nicolas Mailhot
Subject: Re: XML-like date/time support ?
Date: Sun, 08 Jan 2006 22:31:55 +0100

Le dimanche 08 janvier 2006 à 22:15 +0100, Jim Meyering a écrit :
> Nicolas Mailhot <address@hidden> wrote:
> >> The full format used in the note, save the fractional part of a second,
> >> can be specified as:
> >>
> >> $ date '+%Y-%m-%dT%H-%M-%S%:z'
> >> 2006-01-08T19-29-44+00:00
> >
> > It's a pity about the fractional part - it's useful when you need to
> > generate unique identifiers.
> 
> Doesn't %N do what you want?
> 
>   %N   nanoseconds (000000000..999999999)

Right, didn't realise there was enough zeros to reach the seconds ;)

> > Maybe a --iso-8601, --w3c or --xml flag would be in order ?
> 
> From --help output:
> 
>       --rfc-3339=TIMESPEC   output date and time in RFC 3339 format.
>                             TIMESPEC=`date', `seconds', or `ns' for
>                             date and time to the indicated precision.
> 
> E.g.,
> 
>   $ date --rfc-3339=ns
>   2006-01-08 22:14:12.196485000+01:00

This is not exactly the same format. W3C format would be 

2006-01-08T22:14:12.196485000+01:00

(no space, much better for loads of stupid scripts)

And combined with -u it would give
2006-01-08T22:14:12.196485000Z

not
2006-01-08 22:14:12.196485000+00:00


Regards,

-- 
Nicolas Mailhot

Attachment: signature.asc
Description: Ceci est une partie de message numériquement signée


reply via email to

[Prev in Thread] Current Thread [Next in Thread]