Question about ISO8601 vs. strftime()




I'm not sure if I'm misreading things, that my implementation
may have a 'bug' relative to the ISO 8601 standard, C99
strftime() doesn't match ISO 8601, or some combination of the
above.

Looking at a number of online references, there seem to be a
large number of possible options for ISO 8601 compliant date and
time strings, depending upon usage. However, the one I am
interested in is for something like a timestamp value,
containing both a date and a time value. From what I've seen,
the proper representation for that would be something like:

2006-12-23T15:34:15-06:00

Here, the year-month-day, followed by the "T" character to
represent a time following, namely hours:minutes:seconds,
followed by a dash, then the offset from UTS in hours and
minutes.

Looking at strftime, I would expect this format string to yield
the expected results:

"%Y-%m-%dT%H:%M:%S%z"

However, on my implementation (Mac OS X with Xcode 2.4.1 (an IDE
front-end to gcc 4.0.1 as I'm using it), that will yield almost
the same results, but not quite:

2006-12-23T15:34:15-0600

Note the lack of a ':' separator between the hours and minutes
field (%z) for the UTC offset.

Looking at some logfiles on the system, the latter format
appears in some other places, so I don't think it's the way I'm
calling it. The man page on the platform says the lack of a
delimiter for the offset field is to conform to RFC822 date
headers. Looking at ISO 9899:1999 at the strftime
documentation (7.23.3.5), the same form, without the ':' is
shown. So, is this a case where the C99 standard definition
differs from ISO 8601, and C won out?

So, my question is, with respect to ISO 8601, are both forms
valid? Or is the strftime() one actually correct, and a slew of
online references to ISO8601 just get it wrong? I don't have
official ISO 8601 documentation, just references to it via the
web.

--
Randy Howard (2reply remove FOOBAR)
"The power of accurate observation is called cynicism by those
who have not got it." - George Bernard Shaw





.



Relevant Pages

  • Re: FAQ Topic - How do I format a date with javascript? (2009-02-08)
    ... it is either an unspecified offset from GMT or GMT ... It's ISO 8601 followed by something. ... It is time offset. ... | Never use a local date/time for a non-local event. ...
    (comp.lang.javascript)
  • Re: mounting an iso file. multiple mount points?
    ... >> You may used the enclosed script to split the ISO image into slices ... >> and then use lofiadm to mount the slices. ... but i figured i'd have to know an offset. ... Head of Sun Support, Sr. ...
    (comp.unix.solaris)
  • ECMAScript 4+ Date proposals
    ... Implement, for ISO ... the Offset argument is used if present; ... normalise); and the Boolean gives a validation result. ... Javascript; but a system implementation could be more efficient. ...
    (comp.lang.javascript)
  • strftime() ISO8601 question.
    ... 'bug' relative to the ISO 8601 standard, ... Looking at a number of online references, ... I would expect this format string to yield ... is this a case where the C99 standard definition ...
    (comp.programming)
  • Re: reading the raw iso from a CD-Extra (multisession CD)
    ... dd does not understand fs be it iso or else. ... with three different drives, but all of my drives are a bit old and ... I can't loop mount it (obviously I've tried subtracting the offset) so ... Surely someone somewhere has copied a CD-Extra before ... ...
    (Debian-User)