duration property

mdex:duration properties represent a duration of time.

An mdex:duration property represents a duration of the days, hours, and minutes of an instance of time. A time zone is not allowed as part of the time representation.

The mdex:duration format is:
'P' {d 'D'} 'T' {h 'H'} {m 'M'} {s {'.' s+} 'S'}
where:
  • P is a mandatory literal that indicates that this is a period of time.
  • For the d'D' parameter, d specifies the number of days, while the literal D indicates that this is the days field.
  • T is a literal date/time separator that must be present if (and only if) any time fields are specified.
  • For the h'H' parameter, h specifies the number of hours, while the literal H indicates that this is the hours field.
  • For the m'M' parameter, m specifies the number of minutes, while the literal M indicates that this is the minutes field.
  • For the s'S' parameter, s specifies the number of whole seconds, while the literal S indicates that this is the seconds field. '.' s+ is optional and, if present, represents the fractional seconds. The internal representation is only precise to the millisecond, which means that a specification of four or more digits is truncated to three digits.

All time durations are optional, but at least one must be present. An optional preceding minus sign ('-') is allowed to indicate a negative duration.

duration format examples

This example specifies a duration of 429 days, 1 hour, 2 minutes, and 3 seconds:
P429DT1H2M3S
This example specifies a duration of 429 days:
P429D
This example specifies a duration of 429 days, 2 minutes, and 3.25 seconds:
P429DT2M3.25S
This example specifies a 1 hour and 2 minutes:
PT1H2M
This example specifies a negative duration of 429 days and 3 seconds:
-P429DT3S

Example of ingesting duration properties

The following request updates Record 344 with five duration properties:
<ns:ingestChanges>
<ns:updateRecords>
 <ns:recordSpecifier>FactSalesID='344'</ns:recordSpecifier>
   <ns:addAssignments>
     <ns1:attribute name="duration1" type="mdex:duration">P429DT1H2M3S</ns1:attribute>
     <ns1:attribute name="duration2" type="mdex:duration">P429D</ns1:attribute>
     <ns1:attribute name="duration3" type="mdex:duration">P429DT2M3.25S</ns1:attribute>
     <ns1:attribute name="duration4" type="mdex:duration">PT1H2M</ns1:attribute>
     <ns1:attribute name="duration5" type="mdex:duration">-P429DT3S</ns1:attribute>
   </ns:addAssignments>
  </ns:updateRecords>
</ns:ingestChanges>

Note that the duration5 property has a negative duration value.