functx:yearMonthDuration
Construct a yearMonthDuration from a number of years and months
Description
The functx:yearMonthDuration function constructs an xs:yearMonthDuration value from two arguments representing a number of years and a number of months. Zero can be represented either by the number 0 or the empty sequence. If both arguments are zero or the empty sequence, it returns P0M.
Parameters |
Description |
---|---|
years:numeric() |
the number of years |
months:integer() |
the number of months |
Examples
XPath |
Results |
---|---|
functx:yearMonthDuration(1,6) |
P1Y6M |
functx:yearMonthDuration(1.5,0) |
P1Y6M |
functx:yearMonthDuration(1,()) |
P1Y |
functx:yearMonthDuration(1,0) |
P1Y |
functx:yearMonthDuration(-1,-3) |
-P1Y3M |
functx:yearMonthDuration(-1,3) |
-P9M |
functx:yearMonthDuration(0,0) |
P0M |