Microformats duration formats
Introduction
Although microformats use two subsets of ISO 8601 standard to describe dates and times, duration are taken directly from ISO standard. There are in fact two way different ways to represent a duration in ISO 8601. Both start with the letter P which stands for period. The most common of the two representations is a combination of numbers followed by letters. So P10D stands for 10 days. The second is a variation on the date and time format P0001-02-10 stands for 1year, 2 months and 10 days. Both these representations can be used as microformat duration.
Representation 1
Summary of rules to create a duration
- The capital letters 'P', 'Y', 'M', 'W', 'D', 'T', 'H', 'M', and 'S' are designators for each of the date and time elements
- P is the duration designator (historically called "period") placed at the start of the duration representation.
- Y - number of years.
- M - number of months.
- W - number of weeks.
- D - number of days.
- T is the time designator that comes before the time.
- H - number of hours.
- M - number of minutes.
- S - number of seconds.
- MUST use T punctuation to mark the beginning of the time segment
- CAN use decimal fraction on the smallest value
- The designator MUST be uppercased
- Date and time values CAN exceed their "carry-over points" i.e. P45H is 45 hour
Representation 1 format examples
ISO 8601 duration format - representation 1 - valid structures
P9MP1Y2M
P1Y2M10D
P1Y2M10DT20H
P1Y2M10DT20H30M
P1Y2M10DT20H30M30S
P1Y2M10DT20H30M30.5S
P1Y2M10DT20.5H
P110D
PT30M
Representation 2
Summary of rules to create a duration
- MUST start with the letter P
- MUST use a full 4 digit for year
- MUST use a full 2 digit for month, days, hours, min and sec
- MUST use T punctuation to mark the beginning of the time segment
- MUST use dash "-" for date punctuation
- MUST use colon ":" for time punctuation
- Date and time values CAN NOT exceed their "carry-over points" i.e. P0001-13 is wrong you can only have 11 months
Representation 2 format examples
ISO 8601 duration format - representation 2 - valid structures
P0001-02-10
P0001-02-10T14:30:30
Some rights reserved