strftime() ISO8601 question.
- From: Randy Howard <randyhoward@xxxxxxxxxxxxxxxxx>
- Date: Sun, 24 Dec 2006 02:57:58 GMT
I'm not sure if I'm misreading things, my implementation has a
'bug' relative to the ISO 8601 standard, or both.
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 correct 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?
It would appear I am using the exact same format string as used
by other developers on the platform.
So, my question is, with respect to ISO 8601, are both forms
valid? 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
.
- Follow-Ups:
- Re: strftime() ISO8601 question.
- From: Randy Howard
- Re: strftime() ISO8601 question.
- Prev by Date: Question about ISO8601 vs. strftime()
- Next by Date: Re: strftime() ISO8601 question.
- Previous by thread: Question about ISO8601 vs. strftime()
- Next by thread: Re: strftime() ISO8601 question.
- Index(es):
Relevant Pages
|