IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.



#Automation


#Applicationintegration
#webMethods
#Integration
 View Only
  • 1.  datTimeDuration

    Posted 06/11/12 09:34 AM

    Hi,

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

    Grtz,
    Wouter


    #API-Management
    #Tamino
    #webMethods


  • 2.  RE: datTimeDuration

    Posted 06/11/12 03:38 PM

    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)


    #Tamino
    #webMethods
    #API-Management