How to define XQuery hours-from-duration function in XML

In this article, we are going to explain XQuery hours-from-duration-function
  • 1598

hours-from-duration Function

The hours-from-duration Function calculates hours in a duration. It has a argument:

  • duration

it have fallowing properties- 

  • deterministic

  • context-independent

  • focus-independent

Syntax of hours-from-duration Function

fn:hours-from-duration(DurationValue)

DurationValue also consist  one of the fallowing types-

  • xdt:dayTimeDuration
  • xs:duration
  • xdt:yearMonthDuration
Example of hours-from-duration Function
 

fn:hours-from-duration(
xdt:dayTimeDuration("PT127H")) and returned value is 7, because 127 hours means 5 days and 7 hours; then it returnd 7 hour.

Further Readings

You may also want to read these related articles:

Ask Your Question 

Got a programming related question? You may want to post your question here
 

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.