xs:dateTime

The primitive type xs:dateTime represents a combined date and time. The lexical representation of xs:dateTime is YYYY-MM-DDThh:mm:ss.sss, which is a concatenation of the xs:date and xs:time representation, with an uppercase letter T between them. The constraints described for the xs:date and xs:time types are also true for xs:dateTime. A time zone can be added to the end, as described in "Time Zones" in Chapter 19.

Table B-4 lists some values of the xs:dateTime type. For more information on working with dates and times, see Chapter 19.

Table B-4. Values of the xs:dateTime type

Values

Explanation

Valid

 
2006-05-03T13:20:00

1:20 P.M. on May 3, 2006

2006-05-03T13:20:15.5

1:20 P.M. and 15.5 seconds on May 3, 2006

2006-05-03T13:20:00-05:00

1:20 P.M. on May 3, 2006, U.S. Eastern Standard Time

2006-05-03T13:20:00Z

1:20 P.M. on May 3, 2006, Coordinated Universal Time (UTC)

2006-05-03T24:00:00

Midnight the evening of May 3/morning of May 4

2006-05-04T00:00:00

Midnight the evening of May 3/morning of May 4 (equal to the previous example)

Invalid

 
2006-05-03T13:00

Seconds must be specified

2006-05-03

The time is required

2006-05-0313:20:00

The letter T is required

 

An empty value or zero-length string is not permitted

Values of type xs:dateTime can be constructed using the standard xs:dateTime constructor. In addition, a function named dateTime can be used to construct an xs:dateTime value from an xs:date and an xs:time. You can obtain the current date/time ...

Get XQuery now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.