bug-coreutils
[Top][All Lists]
Advanced

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

date not parsing full iso-8601


From: Nic Ferrier
Subject: date not parsing full iso-8601
Date: Tue, 10 May 2005 21:33:39 +0100

As I read the documentation for gnu date it should parse iso-8601
dates correctly:

   File: coreutils.info,  Node: General date syntax
   
   .
   .
   .
   
   The output of `date' is not always acceptable as a date string, not
   only because of the language problem, but also because there is no
   standard meaning for time zone items like `IST'.  When using `date'
   to generate a date string intended to be parsed later, specify a
   date format that is independent of language and that does not use
   time zone items other than `UTC' and `Z'.  Here are some ways to do
   this:

     $ LC_ALL=C TZ=UTC0 date
     Fri Dec 15 19:48:05 UTC 2000
     $ TZ=UTC0 date +"%Y-%m-%d %H:%M:%SZ"
     2000-12-15 19:48:05Z
     $ date --iso-8601=seconds  # a GNU extension
     2000-12-15T11:48:05-0800
     $ date --rfc-2822  # a GNU extension
     Fri, 15 Dec 2000 11:48:05 -0800
     $ date +"%Y-%m-%d %H:%M:%S %z"  # %z is a GNU extension.
     2000-12-15 11:48:05 -0800

But it doesn't appear that date does parse an iso-8601 date:

  $ date --date "2004-12-18T17:28:00+0000"
  date: invalid date `2004-12-18T17:28:00+0000'

This also fails:

  $ date --date "`date --iso-8601=seconds`"

Curiously it seems to be the timezone that it doing it because this
DOES work:

  $ date --date "2004-12-18T17:28:00"


Have I just misunderstood GNU date or have I really found a bug?



Nic Ferrier




reply via email to

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