functx:dayTimeDuration
Construct a dayTimeDuration from a number of days, hours, etc.
Description
The functx:dayTimeDuration function constructs an xs:dayTimeDuration value from arguments representing the number of days, hours, minutes and seconds. Zero can be represented either by the number 0 or the empty sequence. If all arguments are zero or the empty sequence, it returns P0M.
Parameters |
Description |
|---|---|
days:numeric() |
the number of days |
hours:numeric() |
the number of hours |
minutes:numeric() |
the number of minutes |
seconds:numeric() |
the number of seconds |
Examples
XPath |
Results |
|---|---|
functx:dayTimeDuration(1,6,0,0) |
P1DT6H |
functx:dayTimeDuration(2.5,0,0,0) |
P2DT12H |
functx:dayTimeDuration(1,(),3,5.6) |
P1DT3M5.6S |
functx:dayTimeDuration(0,0,5,0) |
PT5M |
functx:dayTimeDuration(0,0,0,0) |
PT0S |
In a generator
Copy the snippet below and paste it in Freemapper, under a language node inside the generators element. Each line of the pattern prints the result of one example; to see them, run mi generate <project> <language> example-functx-dayTimeDuration.
[e] example-functx-dayTimeDuration
[e] start
[e] match
[v] /
[e] body
[e] write-pattern
[v] examples
[e] patterns
[e] examples
[v] E01: {{ functx:dayTimeDuration(1,6,0,0) }}
[v] E02: {{ functx:dayTimeDuration(2.5,0,0,0) }}
[v] E03: {{ functx:dayTimeDuration(1,(),3,5.6) }}
[v] E04: {{ functx:dayTimeDuration(0,0,5,0) }}
[v] E05: {{ functx:dayTimeDuration(0,0,0,0) }}