home contribute faq download

FunctX XQuery Functions

functx:total-days-from-duration

The total number of days in a dayTimeDuration

Google
Webdatypic.com

Description

The functx:total-days-from-duration function returns the total number of days in $duration. If it is an uneven number of days, it will return a fractional part. This function is different from the built-in fn:days-from-duration function because the latter will not return a fractional part. If $duration is the empty sequence, the empty sequence is returned.

Arguments and Return Type

NameTypeDescription
$duration xs:dayTimeDuration? the duration
return value xs:decimal?

XQuery Function Declaration

See XSLT definition.
declare namespace functx = "http://www.functx.com";
declare function functx:total-days-from-duration
  ( $duration as xs:dayTimeDuration? )  as xs:decimal? {

   $duration div xs:dayTimeDuration('P1D')
 } ;

Examples

XQuery ExampleResults
functx:total-days-from-duration(
     xs:dayTimeDuration('PT24H'))
1
functx:total-days-from-duration(
     xs:dayTimeDuration('P1D'))
1
functx:total-days-from-duration(
     xs:dayTimeDuration('PT36H'))
1.5
functx:total-days-from-duration(
     xs:dayTimeDuration('PT48H'))
2

See Also

fn:days-from-durationThe number of days in a duration
functx:total-seconds-from-durationThe total number of seconds in a dayTimeDuration
functx:total-minutes-from-durationThe total number of minutes in a dayTimeDuration
functx:total-hours-from-durationThe total number of hours in a dayTimeDuration
functx:total-months-from-durationThe total number of months in a yearMonthDuration
functx:total-years-from-durationThe total number of years in a yearMonthDuration

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26Priscilla Walmsley, Datypic, pwalmsley@datypic.com, http://www.datypic.com
Datypic XQuery Services

Recommended Reading:

XQuery