xs:gDay

Converts $string-var (a string in the gDay format) to the gDay 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 gDay format, the following error is reported:

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

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

Signatures

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

Arguments

Data Type
Argument
Description

xs:string

$string-var

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

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



---

Beginning prefix.



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 day in the gDay data type.

Examples

Simple

Invoking gDay("---15") returns a gDay value corresponding to the15th of the month, as shown in the following example query:

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

The preceding query, generates the following XML result:

<result>---15</result> 

UTC Time Zone

Invoking gDay("---15Z") returns a gDay value corresponding to the 15th of the month in the UTC time zone, as shown in the following example query:

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

The preceding query, generates the following XML result:

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

Error—Incorrect Format

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

For example, the following example query:

<result>{xs:gDay("15")}</result> 

Produces the following error:

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

Related Topics

W3C gDay data type description