No, I don't think there's an off-the-shelf answer: a case for writing your own functions using xsl:function.
 
If you're dealing with durations less than a day, you could add the duration to xs:time('00:00:00Z') and then use format-time().
 
Another trick I find handy is to divide a duration by xdt:dayTimeDuration('PT1S') which gives you the length of the duration in seconds, as a number. I personally find it much easier to manipulate durations as numbers than as durations.
 
Michael Kay


From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Cary Millsap
Sent: 20 November 2004 06:49
To: Saxon Help List
Subject: [saxon] format-duration??

I’m looking for an “hh:mm:ss.fff” kind of format for the xdt:dayTimeDuration result of an expression like (xs:dateTime(@t1) – xs:dateTime(@t0)).

 

I haven’t yet found a format-dayTimeDuration function. It seems that the probable reason for its absence is that there’s an elegant way to apply one or more of the existing functions to get the job done.

 

I can use the “get-*-from-dayTimeDuration” suite of functions to extract and format the individual duration components, but I wonder if there’s a  more elegant solution available to me. ?

 

Thank you in advance.

 

Cary Millsap
Hotsos Enterprises, Ltd.
http://www.hotsos.com
Nullius in verba

Upcoming events:
- Performance Diagnosis 101: 1/4
Calgary
- SQL Optimization 101: 11/8
Dallas, 12/13 Atlanta
- Hotsos Symposium 2005: March 6–10
Dallas
- Visit www.hotsos.com for schedule details...