Re: [basex-talk] Issue with years-from-duration!?

2019-12-06 Thread Christian Grün
For advanced computations, it’s sometimes easier to convert duration items to milliseconds with our custom functions [1]: let $ms-years := 1000 * 60 * 60 * 24 * 365 let $dur := xs:dayTimeDuration('P12345DT2M3S') let $ms := convert:dayTime-to-integer($dur) return $ms idiv $ms-years [1]

Re: [basex-talk] Issue with years-from-duration!?

2019-12-06 Thread France Baril
I was going to ask if I could count on the difference always being in a PxxxD format. I am happy to see that days-from-duration doesn't return 0. I tried casting the xs:duration to many formats and kept getting 0. Thanks for the tips On Fri, Dec 6, 2019 at 11:38 AM Christian Grün wrote: > Hi

Re: [basex-talk] Issue with years-from-duration!?

2019-12-06 Thread Christian Grün
Hi France, The function fn:years-from-duration is fairly basic; it only returns the year component of your duration argument (as xs:dayTimeDuration has none, in contrast to xs:yearMonthDuration). The background: A year may have 365 or 366 days, and the duration is not sufficient to compute the

Re: [basex-talk] Issue with years-from-duration!?

2019-12-06 Thread Martin Honnen
Am 06.12.2019 um 11:32 schrieb Martin Honnen: Am 06.12.2019 um 11:23 schrieb France Baril: The following function returns P4511D: 0 but I expect P4511D: 12 Bug or bad usage? let $d1 := xs:date('2007-07-31') let $d2 := xs:date('2019-12-06') let $duration := $d2 - $d1 let

Re: [basex-talk] Issue with years-from-duration!?

2019-12-06 Thread Martin Honnen
Am 06.12.2019 um 11:23 schrieb France Baril: The following function returns P4511D: 0 but I expect P4511D: 12 Bug or bad usage? let $d1 := xs:date('2007-07-31') let $d2 := xs:date('2019-12-06') let $duration := $d2 - $d1 let $years := years-from-duration($duration) return

[basex-talk] Issue with years-from-duration!?

2019-12-06 Thread France Baril
Hi, The following function returns P4511D: 0 but I expect P4511D: 12 Bug or bad usage? let $d1 := xs:date('2007-07-31') > let $d2 := xs:date('2019-12-06') > let $duration := $d2 - $d1 > let $years := years-from-duration($duration) > return $duration || ': ' || $years -- France Baril