datTimeDuration

Hi,

How to get the duration in minutes of two datetimes using XQuery?

Grtz,
Wouter

You can subtract two datetime values and the result is a xs:duration type. From there, you can convert the duration to minutes.
For example

declare namespace tf = "http://namespaces.softwareag.com/tamino/TaminoFunction"
declare namespace sl = "http://namespaces.CentraSite.com/Schema/SOALink"
for $ev in collection("RuntimeMetrics")/sl:metrics
let $dur := ($ev/sl:endTime - $ev/sl:startTime)
let $min := (fn:days-from-duration($dur)*24*60 ) + (fn:hours-from-duration($dur)*60) + fn:minutes-from-duration($dur)
where tf:getInoId($ev) = 1
return $min

(if you need to allow for longer durations than a day, add the appropriate year/month durations also)