Skip to Content
XQuery
book

XQuery

by Priscilla Walmsley
March 2007
Intermediate to advanced content levelIntermediate to advanced
512 pages
21h 15m
English
O'Reilly Media, Inc.
Content preview from XQuery

xs:gMonth

The primitive type xs:gMonth represents a recurring month. It can be used to specify, for example, that year-end auditing occurs in October of every year. It does not represent a number of months; to represent that, use the xs:yearMonthDuration type instead.

The lexical representation of xs:gMonth is --MM. An optional time zone may be used, as described in "Time Zones" in Chapter 19. Table B-12 lists some values of this type.

Table B-12. Values of the xs:gMonth type

Values

Explanation

Valid

 
--06

June

Invalid

 
--06--

Because of an error in the first version of XML Schema, you will often see examples that use this format, but it is technically invalid

--15

The month must be a valid month

2006-06

The year cannot be specified

06

The two leading hyphens are required

--6

It must have two digits

 

An empty value or zero-length string is not permitted

Values of xs:gMonth can be tested for equality (or inequality) with other values of the same type, but you cannot compare them using the operators <, <=, >, or >=.

Values of this type can be cast from the xs:date and xs:dateTime types. For example, the expression xs:date("2006-05-30") cast as xs:gMonth returns an xs:gMonth value of --05. They can also be cast to and from xs:string and xs:untypedAtomic.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

XQuery, 2nd Edition

XQuery, 2nd Edition

Priscilla Walmsley
XPath and XPointer

XPath and XPointer

John Simpson
XQuery Kick Start

XQuery Kick Start

James McGovern, Per Bothner, Kurt Cagle, James Linn, Vaidyanathan Nagarajan
Learning XSLT

Learning XSLT

Michael Fitzgerald

Publisher Resources

ISBN: 0596006349Supplemental ContentErrata