ISO 8601 timestamp in WordPress and Php

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?

Bibliography

Tags: , , , , , , , , ,

Leave a Reply

Categories

Validations

Valid XHTML 1.0 Transitional

Listen to Radio popolare Roma

Da oggi Roma si sente meglio. Radio popolare Roma 103.3. Vede. Sente. Dice. Diretta 0682003666. Abbonamenti 0689929141 Abbonati online Ascolta