MarkLogic 9 Product Documentation
sql:month

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

Summary

Returns an xs:integer between 1 and 12, both inclusive, representing the month component in the localized value of $arg.

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

Parameters
arg The genericDateTime whose month component will be returned.

Example

sql:month(xs:dateTime("1999-05-31T13:20:00-05:00"))
=> 5

Example

sql:month(xs:dateTime("1999-12-31T19:20:00-07:00"))
=> 12

Example

sql:month(
    fn:adjust-dateTime-to-timezone(
        xs:dateTime("1999-12-31T19:20:00-05:00"),
        xs:dayTimeDuration("PT0H")))
=> 1
Powered by MarkLogic Server | Terms of Use | Privacy Policy