Multiplies $yearMonthDuration-var with $decimal-var.
op:multiply-yearMonthDuration(xf:yearMonthDuration $yearMonthDuration-var, xs:decimal $decimal-var) —> xf:yearMonthDuration
Returns the yearMonthDuration value of dividing $yearMonthDuration-var with $decimal-var. The return value is rounded up to the nearest month and year as shown in the following example.
Multiplying the 1 year value of $yearMonthDuration-var by 1.5 results in 1 year and 6 months. Multiplying the 1 month value of $yearMonthDuration-var by 1.5 results in 1.5 months which is rounded up to 2 months. Adding 1 year and 6 months to 2 months results in a yearMonthDuration of 1 year and 8 months as shown in the following example query:
let $yearMonthDuration-var := xf:yearMonthDuration("P1Y1M") return let $decimal-var := 1.5 return let $mydur := op:multiply-yearMonthDuration($yearMonthDuration-var, $decimal-var) return <result> <years>{xf:get-years-from-yearMonthDuration($mydur)}</years> <months>{xf:get-months-from-yearMonthDuration($mydur)}</months> </result>
The preceding query generates the following result:
<result> <years>1</years> <months>8</months> </result>
Multiplying a 1 month yearMonthDuration by 0.49 results in 0.49 months which is rounded down to zero months as shown in the following example query:
let $yearMonthDuration-var := xf:yearMonthDuration("P1M") return let $decimal-var := 0.49 return let $mydur := op:multiply-yearMonthDuration($yearMonthDuration-var, $decimal-var) return <result> <years>{xf:get-years-from-yearMonthDuration($mydur)}</years> <months>{xf:get-months-from-yearMonthDuration($mydur)}</months> </result>
The preceding query generates the following result:
<result> <years>0</years> <months>0</months> </result>
W3C multiply-yearMonthDuration operator description.
W3C yearMonthDuration description.
xf:yearMonthDuration constructor description.