DB2 10.5 for Linux, UNIX, and Windows

dateTime data type

The xs:dateTime data type represents an instant that has the following properties: year, month, day, hour, and minute properties that are expressed as integer values; a second property that is expressed as a decimal value; and an optional time zone indicator. Derived from data type xdt:anyAtomicType.

Valid lexical representations of xs:dateTime might not have an explicit time zone. For representations that do not have an explicit time zone, an implicit time zone of UTC (Coordinated Universal Time, also called Greenwich Mean Time) is used. Each property expressed as a numeric value is constrained to the maximum value within the interval that is determined by the next-higher property. For example, the day value can never be 32 and cannot even be 29 for month 02 and year 2002 (February 2002).

The lexical form of xs:dateTime is a finite-length sequence of characters of the following form: yyyy-mm-ddThh:mm:ss.sssssszzzzzz. Negative dates are not allowed. The following abbreviations describe this form:
yyyy
A 4-digit numeral that represents the year. Valid values are from 0001 through 9999. A plus sign (+) is not allowed.
-
Separators between parts of the date portion
mm
A 2-digit numeral that represents the month.
dd
A 2-digit numeral that represents the day.
T
A separator to indicate that the time of day follows.
hh
A 2-digit numeral that represents the hour. A value of 24 is allowed only when the minutes and seconds that are represented are zero. A query that includes the time of 24:00:00 is treated as 00:00:00 of the next day.
:
A separator between parts of the time portion.
mm
A 2-digit numeral that represents the minute.
ss
A 2-digit numeral that represents the whole seconds.
.ssssss
Optional. If present, a 1-to-6 digit numeral that represents the fractional seconds.
zzzzzz
Optional. If present, represents the timezone. See Timezone indicator for more information about the format for this property.

For example, the following form indicates noon on 10 October 2005, Eastern Standard Time in the United States:

2005-10-10T12:00:00-05:00

This time is expressed in UTC as 2005-10-10T17:00:00Z.

Timezone indicator

The lexical form for the timezone indicator is a string that includes one of the following forms:
  • A positive (+) or negative (-) sign that is followed by hh:mm, where the following abbreviations are used:
    hh
    A 2-digit numeral (with leading zeros as required) that represents the hours. Currently, no legally prescribed time zones have durations greater than 24 hours. Therefore, a value of 24 for the hours property is allowed only when the value of the minutes property is zero.
    mm
    A 2-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.