Loading TOC...

MarkLogic Server 11.0 Product Documentation
sql:hours

sql:hours(
   $arg as xs:genericDateTimeArg?
) as xs:integer?

Summary

Returns an xs:integer between 0 and 23, both inclusive, representing the value of the hours component in the localized value of $arg.

If $arg is the empty sequence, returns the empty sequence.

Parameters
arg The genericDateTime whose hours component will be returned.

Example

sql:hours(xs:time("11:23:00"))
=> 11

Example

sql:hours(xs:time("21:23:00"))
=> 21

Example

sql:hours(xs:time("01:23:00+05:00"))
=> 1

Example

sql:hours(
    fn:adjust-time-to-timezone(
         xs:time("01:23:00+05:00"),
         xs:dayTimeDuration("PT0H")))
=> 20

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.