Yenya's World

Thu, 24 Aug 2006

W3C Date and Time

Apparently W3C has defined its own date and time format, incompatible with anything else. And what is worse, they use the "+HH:MM" format for the timezone offset, which means W3C time format cannot be formated with standard library's strftime(3) function.

POSIX (and ISO C99) defines the "%Z" fromat string for the textual name of the time zone only. GNU libc (and Perl as well) provide an extension "%z" which leads to "+HHMM" format, suitable for formating RFC822-style time zone offsets. But W3C had to invite yet another format, this time with colon between hours and minutes. Why the standardization organizations cannot reuse an existing practice, and have always to create something different and difficult to produce with standard tools?

CPAN has DateTime::Format::W3CDTF, so at least the Perl side is safe (altough I have not tried it yet, and from their docs it is not clear how they handle the time zone at all). But it uses the DateTime object as a time source, instead of the return value of localtime() or gmtime().

Section: /computers (RSS feed) | Permanent link | 5 writebacks


Yenya's World: Linux and beyond - Yenya's blog.


RSS feed

Jan "Yenya" Kasprzak

The main page of this blog



Blog roll:

alphabetically :-)