Microformats testsuite

Microformats date and time formats

Introduction

Microformats use two subsets of ISO 8601 standard to describe dates and times. ISO 8601 is an expansive standard which contains a large number of different ways to represent dates and time. To reduce the possibility of errors and the complexity for authors, the community has chosen to restrict the supported formats used in microformats. These restricted subsets are called profiles. The two profiles that can be used for microformat dates are the W3C Note datetime profile and RFC 3339 profile.

Convert to W3C Note datetime profile

This code takes either of the two profiles and returns a date time formatted to the W3C Note DateTime Profile.

Compare

This code takes the two dates in either profile and compares them to see if they are equal.

 

W3C Note datetime

W3C Note datetime - summary of rules which create the subset profile

W3C Note datetime format examples

W3C Note datetime profile - valid structures 
2007
2007-05
2007-05-01T11:30
2007-05-01T11:30Z
2007-05-01T11:30:00Z
2007-05-01T11:30+08:00
2007-05-01T11:30:00+08:00
2007-05-01T11:30:00.0135

RFC 3339

RFC 3339 - summary of rules which create the subset profile

RFC 3339 format examples

RFC 3339 profile - valid structures     
2007
2007-05
2007-05-01T11:30
2007-05-01T11:30Z
2007-05-01T11:30:00Z
2007-05-01T11:30+08:00
2007-05-01T11:30:00+08:00
2007-05-01T11:30:00.0135
200801
20080121
20070501T1130
20070501T113015
20070501T113015Z
20070501t113025z
2007-05-01T113025
20070501T11:30:25

Vaild ISO 8601 datatime that SHOULD NOT be used in Microformats

Although the following formats may be valid ISO structures they are not part of the two profiles use for microformats and should not be used. 

070501  
07-05-01
20070501 1130
20070501 113015Z
2007-05-01 11:30:00+08:00
2007-05-01 11:30:00.0135
2007-05-01T11.0150
2007-05-01T11:30.0150
2008-W21
2008W21
2008-W21-5
2008W215
2008-144
2008144
etc...

 

Some rights reserved