Re: Question about ISO8601 vs. strftime()
- From: Ian Woods <newspub3@wuggydotorg>
- Date: Sat, 23 Dec 2006 21:27:29 -0600
Randy Howard <randyhoward@xxxxxxxxxxxxxxxxx> wrote in
news:0001HW.C1B3468A0030F467F0203648@xxxxxxxxxxxxxxxx:
<snip>
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.
<snip>
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.
I don't have a copy of the real ISO 8601 either. AFAIK, both the forms
with and without separators are allowed and equivalent. This certainly
seems to be the case from a number of sources including:
http://www.cl.cam.ac.uk/~mgk25/iso-time.html
http://en.wikipedia.org/wiki/ISO_8601 (looking at the "formats" on the
RHS)
http://hydracen.com/dx/iso8601.htm
It also appears to be permitted by the attempted ABNF grammar described
here:
http://www.imc.org/ietf-calendar/archive1/msg00501.html
Of course, each of these references could all be wrong, but I think
that's somewhat unlikely! :)
Ian Woods
.
- Follow-Ups:
- Re: Question about ISO8601 vs. strftime()
- From: Randy Howard
- Re: Question about ISO8601 vs. strftime()
- References:
- Question about ISO8601 vs. strftime()
- From: Randy Howard
- Question about ISO8601 vs. strftime()
- Prev by Date: Re: strftime() ISO8601 question.
- Next by Date: Re: Question about ISO8601 vs. strftime()
- Previous by thread: Question about ISO8601 vs. strftime()
- Next by thread: Re: Question about ISO8601 vs. strftime()
- Index(es):
Relevant Pages
|