Durations
For calculating durations you can use a function like subtract-dates-yeilding-dayTimeDuration(), or just use the subtraction operator "-" with two date values:
<xsl:value-of select="subtract-dates-yeilding-dayTimeDuration(xs:date(M2008-06-24") , xs:date("2008-06-22"))M/>
The result is an xs:dayTimeDuration value of "P2D". Duration functions work in the opposite direction. For example, you can use the hours-from-duration() function on "P2D" to get "48":
<xsl:variable name="hours"
select="hours-from-duration(xdt:dayTimeDuration('P2D'))"/>
Post a comment