Loading TOC...

MarkLogic 12 EA 2 Product Documentation
fn.hoursFromDateTime

fn.hoursFromDateTime(
   arg as Date?
) as Number?

Summary

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

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

Parameters
arg The dateTime whose hours component will be returned.

Example

fn.hoursFromDateTime(
    xs.dateTime("1999-05-31T08:20:00-05:00"))
=> 8

Example

fn.hoursFromDateTime(
    xs.dateTime("1999-12-31T21:20:00-05:00"))
=> 21

Example

fn.hoursFromDateTime(
  fn.adjustDateTimeToTimezone(
    xs.dateTime("1999-12-31T21:20:00-05:00"),
    xs.dayTimeDuration("PT0H"))) 
=> 2

Example

fn.hoursFromDateTime(
    xs.dateTime("1999-12-31T12:00:00"))
=> 12

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