Description
The functx:total-seconds-from-duration function returns the total number of seconds in $duration. This is different from the built-in fn:seconds-from-duration function because the latter will normalize the value and only give you the remainder number of seconds between 1 and 60. For example, fn:seconds-from-duration(xs:dayTimeDuration("PT90S")) will return 30, while functx:total-seconds-from-duration(xs:dayTimeDuration("PT90S")) will return 90. If $duration is the empty sequence, the empty sequence is returned.
Arguments and Return Type| Name | Type | Description |
$duration |
xs:dayTimeDuration? |
the duration |
| return value |
xs:decimal? |
XQuery Function Declaration| See XSLT definition. | | XQuery Syntax for January 2007 (1.0): |
|---|
declare namespace functx = "http://www.functx.com";
declare function functx:total-seconds-from-duration
( $duration as xs:dayTimeDuration? ) as xs:decimal? {
$duration div xs:dayTimeDuration('PT1S')
} ; | | XQuery Syntax for July 2004 - November 2005 (CR): |
|---|
declare namespace functx = "http://www.functx.com";
declare function functx:total-seconds-from-duration
( $duration as xdt:dayTimeDuration? ) as xs:decimal? {
$duration div xdt:dayTimeDuration('PT1S')
} ; | | XQuery Syntax for May 2003: |
|---|
declare namespace functx = "http://www.functx.com"
define function total-seconds-from-duration
( $duration as xdt:dayTimeDuration? ) as xs:decimal? {
$duration div xdt:dayTimeDuration('PT1S')
} |
Examples| XQuery Example | Results |
|---|
functx:total-seconds-from-duration(
xs:dayTimeDuration('PT90S'))
|
90
|
functx:total-seconds-from-duration(
xs:dayTimeDuration('PT90.5S'))
|
90.5
|
functx:total-seconds-from-duration(
xs:dayTimeDuration('PT1M30S'))
|
90
|
functx:total-seconds-from-duration(
xs:dayTimeDuration('PT3M'))
|
180
|
See AlsoHistory |
|