Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the canonical representation of zero in ISO 8601 durations?

http://en.wikipedia.org/wiki/ISO_8601#Durations

It's not clear what the most correct representation of zero in ISO 8601 durations is.

Possible candidates:

PT0S

This site: http://www.ostyn.com/standards/scorm/samples/ISOTimeForSCORM.htm says

PT0H0M0S

Or probably the simplest is

P

But what is most correct? Is there a canonical zero duration representation?

like image 706
Emlyn O'Regan Avatar asked Apr 23 '15 12:04

Emlyn O'Regan


1 Answers

The single letter "P" is certainly wrong because at least one duration element must be present.

The SCORM-specification requires "PT0H0M0S" only because of backwards compatibility with earlier SCORM-Versions, not because ISO mandates it. Citation from the link you have given:

the SCORM 2004 1.3.1 conformance test suite was coded to require the PT0H0M0S format for the initial zero value of the total attempt time; using that format is therefore recommended where compatibility with early implementations of SCORM 2004 is required.

So if you don't use SCORM then the expression "PT0S" is completely sufficient. However, I don't remember any location in the original ISO-8601-paper where they have specified how a zero duration has to look like. On the contrary, ISO-8601 also describes alternative duration formats like "P0000-00-00T00:00".

There is not only one single canonical representation if we interprete the word "canonical" as "conform with ISO-8601".

Update (after looking in the original ISO-paper):

ISO-8601 mandates at least one element for a zero duration (4.4.3.2.c - page 21):

If the number of years, months, days, hours, minutes or seconds in any of these expressions equals zero, the number and the corresponding designator may be absent; however, at least one number and its designator shall be present.

Paragraph 4.4.3.3 says:

The complete representation of the expression for duration in the alternative format is as follows:

Basic format: PYYYYMMDDThhmmss or PYYYYDDDThhmmss

Extended format: PYYYY-MM-DDThh:mm:ss or PYYYY-DDDThh:mm:ss

Keep also in mind that not every software is capable of supporting all format variations.

like image 59
Meno Hochschild Avatar answered Nov 03 '22 00:11

Meno Hochschild