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 timezone 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).
Note that 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:
<ingest:ingestRecords
xmlns:ingest="http://www.endeca.com/MDEX/ingest/1/0"
xmlns:mdex="http://www.endeca.com/MDEX/XQuery/2009/09">
<ingest:addAssignments>
<mdex:record>
<FactSalesID>344</FactSalesID>
<duration1 type="mdex:duration">P429DT1H2M3S</duration1>
<duration2 type="mdex:duration">P429D</duration2>
<duration3 type="mdex:duration">P429DT2M3.25S</duration3>
<duration4 type="mdex:duration">PT1H2M</duration4>
<duration5 type="mdex:duration">-P429DT3S</duration5>
</mdex:record>
</ingest:addAssignments>
</ingest:ingestRecords>
Note that the duration5 property has a negative duration value.