xs:dateTime
The data type xs:dateTime represents an instant in time.
- year
- month
- day
- hour
- minute
- second
- time zone (optional)
The year, month, day, hour, and minute properties are expressed as integer values. The seconds property is expressed as a decimal value. The time zone property is expressed as a time zone indicator.
Lexical form
The lexical form of xs:dateTime is a finite-length sequence of characters of the following form: yyyy-mm-ddThh:mm:ss.sssssssssssszzzzzz. The following abbreviations describe this form:
- yyyy
- A four-digit numeral that represents the year.
The value cannot begin with a negative (-) sign or a plus (+) sign.
0001 is the lexical representation of the year 1 of the Common Era (also known as 1 AD).
The value cannot be 0000.
- -
- Separators between parts of the date portion
- mm
- A two-digit numeral that represents the month.
- dd
- A two-digit numeral that represents the day.
- T
- A separator to indicate that the time of day follows.
- hh
- A two-digit numeral (with leading zeros as required) that represents the hours. The value must be between -14 and +14, inclusive.
- :
- A separator between parts of the time portion.
- mm
- A two-digit numeral that represents the minute.
- ss
- A two-digit numeral that represents the whole seconds.
- .ssssssssssss
- Optional. If present, a 1-to-12 digit numeral that represents the fractional seconds.
- zzzzzz
- Optional. If present, represents the time zone. If a time zone is not specified the dateTime has no timezone; however, an implicit time zone of UTC (Coordinated Universal Time, also called Greenwich Mean Time) is used for comparison and arithmetic operations.
Each part of the datetime value that is expressed as a numeric value is constrained to the maximum value within the interval that is determined by the next-higher part of the datetime value. For example, the day value can never be 32 and cannot be 29 for month 02 and year 2002 (February 2002).
Timezone indicator
- A positive (+) or negative (-) sign that is followed by
hh:mm
, where the following abbreviations are used:- hh
- A two-digit numeral (with leading zeros as required) that represents the hours. The value must be between -14 and +14, inclusive.
- mm
- A two-digit numeral that represents the minutes. The value of the minutes property must be zero when the hours property is equal to 14.
- +
- Indicates that the specified time instant is in a time zone that is ahead of the UTC time by hh hours and mm minutes.
- -
- Indicates that the specified time instant is in a time zone that is behind UTC time by hh hours and mm minutes.
- The literal
Z
, which represents the time in UTC (Z
represents Zulu time, which is equivalent to UTC). Specifying Z for the time zone is equivalent to specifying+00:00
or-00:00
.
Example
The following form indicates noon on 10 October 2009, Eastern Standard Time in the United States:
2009-10-10T12:00:00-05:00
This
time is expressed in UTC as 2009-10-10T17:00:00Z
.