xs:gMonthDay

Converts $string-var (a string in the gMonthDay format) to the gMonthDay data type.

If the value of $string-var is the empty sequence, the empty sequence is returned. The empty sequence is a sequence containing zero items (), which is similar to null in SQL.

If the value of $string-var is not valid to the gMonthDay format, the following error is reported:

Could not cast "invalid_gMonthDay_string" to type [gMonthDay@htttp://www.w3.org/2001/XMLSchema] is displayed.

Where invalid_gMonthDay_string is the string not valid to the time format, for example: "08-15".

Signatures

xs:gMonthDay(xs:string $string-var) —> xs:gMonthDay

Arguments

Data Type
Argument
Description

xs:string

$string-var

Represents a string with the month and day specified with one of the following formats:

  • --MM-DD
  • --MM-DDZ
  • --MM-DD+hh:mm
  • --MM-DD-hh:mm



--

Beginning prefix.

MM

Month (as a number).

-

Separator between months and days.

DD

Day.

+

Positive time zone offset. This option is optional. If a plus or minus is not specified, + is assumed.

-

Negative time zone offset. (Optional)

hh

Number of hours that the time zone differs from UTC.

mm

Number of minutes that the time zone differs from UTC.

Z

Indicates that the time corresponds to the UTC time zone.

Returns

Returns the specified month and day in the gMonthDay data type.

Examples

Simple

Invoking gMonthDay("--08-15") returns a gMonthDay value corresponding to August 15, as shown in the following example query:

<result>{xs:gMonthDay("--08-15")}</result> 

The preceding query, generates the following XML result:

<result>--08-15</result> 

UTC Time Zone

Invoking gMonthDay("--08-15Z") returns a gMonthDay value corresponding to August 15 in the UTC time zone, as shown in the following example query:

<result>{xs:gMonthDay("--08-15Z")}</result> 

The preceding query, generates the following XML result:

<result>--08-15Z</result> 

Error—Incorrect Format

Invoking gMonthDay("08-15") outputs an error because the -- prefix is missing.

For example, the following example query:

<result>{xs:gMonthDay("08-15")}</result> 

Produces the following error:

Error occurred while executing XQuery: Could not cast "08-15" to type [gMonthDay@http://www.w3.org/2001/XMLSchema] 

Related Topics

W3C gMonthDay data type description