[uf-discuss] hAtom in Wordpress or Php: Iso 8601 timestamp

Lorenzo De Tomasi lorenzo.detomasi at gmail.com
Sat Mar 8 01:11:44 PST 2008


ISO 8601 timestamp in WordPress and Php <
http://isotype.org/2008/01/29/wp_iso8601_timestamp/ >

I'm trying to create a new version of Kubrik WordPress template,
compliant to Microformats hAtom. To do this I need to output a
timestamp compliant to the ISO 8601 standard, defined in the RFC 3339.
It's not easy as it should be…

Microformats code for the timestamp of this post should be: <abbr
class="published" title="2008-01-29T11:42:00+01:00'); ?>">January 29,
2008, 11:42 am</abbr>, where 2008-01-29T11:42:00+01:00 is the ISO 8601
timestamp.

WordPress has not a founction that outputs a standard ISO 8601 timestamp.
The date and time when a post has been published can be called using
WP functions the_time and the date, that follow php rules.

The best result you can achieve using default WP 2.3.1/Php commands is
2008-01-29T11:42:00+0100, without : in the time-offset (+0100 should
be +01:00).

<abbr class="published" title="<?php the_time('Y-m-d\TH:i:sO');
?>"><?php the_date(); ?>, <?php the_time(); ?></abbr>, that is the
default DATE_ISO8601 datetime constant, as defined on pear. So, if you
want this result, it's better to use <?php the_time(DATE_ISO8601); ?>.
But now the question is which is the correct ISO 8601 timestamp?
2008-01-29T11:42:00+01:00 or 2008-01-29T11:42:00+0100?

-- 
Lorenzo De Tomasi
Designer multimodale
http://www.ipernico.it
http://www.isotype.org (in costruzione)



More information about the microformats-discuss mailing list