ISO 8601 Period Format
ISO 8601 Period Format
We use the ISO 8601 Period format to define periods as it is a standard measurement for time periods.
The format always starts with the letter P (for Period), it is then followed by a numerical value (e.g. 18) and then followed by a period designator (e.g. Y for years), these can then be followed by more values and designators.
- P is the duration designator (for period) placed at the start of the duration representation.
- Y is the year designator that follows the value for the number of years.
- M is the month designator that follows the value for the number of months.
- W is the week designator that follows the value for the number of weeks.
- D is the day designator that follows the value for the number of days.
-
T is the time designator that precedes the time components of the representation.
- H is the hour designator that follows the value for the number of hours.
- M is the minute designator that follows the value for the number of minutes.
- S is the second designator that follows the value for the number of seconds.
For example, "P3Y6M4DT12H30M5S" represents a duration of "three years, six months, four days, twelve hours, thirty minutes, and five seconds".
For more information on ISO 8601 you can check out this Wikipedia article.