How to use XQuery year-from-duration function in XML

In this article, we are going to explain duration function in XQuery
  • 1711

years-from-duration Function

The years-from-duration Function returns number of years in duration and that function returns as a decimal format and it have following properties-

  • deterministic

  • context-independent

  • focus-independent

Syntax of years-from-duration Function
 

fn:years-from-duration(DurationValue)

 

DurationValue also consist  one of the fallowing types-

  • xdt:dayTimeDuration
  • xs:duration
  • xdt:yearMonthDuration

Example of years-from-duration Function

fn:years-from-duration(xs:duration("P5Y9M20D") and returned value is 5.

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.