What is the canonical representation of ISO 8601 length zero?


It is not clear what is the most correct representation of zero in ISO 8601 lengths.

Possible candidates:



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



Or perhaps the simplest



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


source to share

1 answer

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

The SCORM specification requires "PT0H0M0S" only because it is backward compatible with earlier versions of SCORM, not because ISO complies with it. Quoting from the link you provided:

The SCORM 2004 1.3.1 conformance test suite was coded to require the PT0H0M0S format for an initial zero total try time; therefore it is recommended to use this format where compatibility with earlier implementations of SCORM 2004.

So, if you are not using SCORM, "PT0S" is sufficient. However, I do not remember the place in the original ISO-8601 paper where they indicated what zero time should look like. In contrast, ISO-8601 also describes alternative duration formats such as "P0000-00-00T00: 00".

There is not only one single canonical representation if we interpret the word "canonical" as "conforming to ISO-8601".

Update (after viewing the original ISO paper):

ISO-8601 contains at least one element for zero duration ( - p. 21):

If the number of years, months, days, hours, minutes, or seconds in any of these expressions is zero, the number and corresponding designation may be missing; however, at least one number and a pointer must be present.

Clause says:

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

Basic format: PYYYYMMDDThmmss or PYYYYDDDThhmsms

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

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



All Articles