functx:duration-from-timezone
Converts a timezone like "-05:00" or "Z" into xs:dayTimeDuration
Description
The functx:duration-from-timezone function accepts a timezone (as it appears in xs:date, xs:time, xs:dateTime etc. values) and converts it to an xs:dayTimeDuration value. The $timezone value can be Z, or in the format (+|-)HH:MM.
Parameters |
Description |
|---|---|
timezone:string() |
the time zone, in (+|-)HH:MM format |
Examples
XPath |
Results |
|---|---|
functx:duration-from-timezone('Z') |
PT0S |
functx:duration-from-timezone('-05:00') |
-PT5H |
functx:duration-from-timezone('+09:00') |
PT9H |
In a generator
Copy the snippet below and paste it in Freemapper, under a language node inside the generators element. Each line of the pattern prints the result of one example; to see them, run mi generate <project> <language> example-functx-duration-from-timezone.
[e] example-functx-duration-from-timezone
[e] start
[e] match
[v] /
[e] body
[e] write-pattern
[v] examples
[e] patterns
[e] examples
[v] E01: {{ functx:duration-from-timezone('Z') }}
[v] E02: {{ functx:duration-from-timezone('-05:00') }}
[v] E03: {{ functx:duration-from-timezone('+09:00') }}