Literal DATETIME

The Literal DATETIME segment specifies a DATETIME value

Use this segment when you see a reference to a literal DATETIME in a syntax diagram.

Syntax

(1)
Literal DATETIME

1  DATETIME ( %Numeric Date
and Time )  %DATETIME  Field Qualifier1
Numeric Date and Time

1  yyyy?  - mo?  - dd?  space hh?  : mi?  : ss?  . fffff
1  mo?  - dd?  space hh?  : mi?  : ss?  . fffff
1  dd?  space hh?  : mi?  : ss?  . fffff
1  hh?  : mi?  : ss?  . fffff
1  mi?  : ss?  . fffff
1  ss?  . fffff
1 fffff
Element Description Restrictions Syntax
dd Day of month, expressed in digits 1 < dd < 28, 29, 30, or 31 Literal Number
fffff Fraction of a second, expressed in digits 0 < fffff < 99999 Literal Number
hh Hour of day, expressed in digits 0 < hh < 23 Literal Number
mi Minute of hour, expressed in digits 0 < mi < 59 Literal Number
mo Month of year, expressed in digits 1 < mo < 12 Literal Number
space Blank space (ASCII 32) Exactly 1 blank character Literal blank space
ss Second of minute, in digits 0 < ss < 59 Literal Number
yyyy Year, expressed in digits No more than 4 digits Literal Number

Usage

You must specify both a numeric date and a DATETIME field qualifier for this date in the Literal DATETIME segment. The DATETIME field qualifier must correspond to the numeric date you specify. For example, if you specify a numeric date that includes a year as the largest unit and a minute as the smallest unit, you must also specify YEAR TO MINUTE as the DATETIME field qualifier.

If you specify two digits for the year, the database server uses the setting of the DBCENTURY environment variable to expand the abbreviated year value to four digits. If the DBCENTURY is not set, the first two digits of the current year are used to expand the abbreviated year value.

The following examples show literal DATETIME values:
DATETIME (07-3-6) YEAR TO DAY

DATETIME (09:55:30.825) HOUR TO FRACTION

DATETIME (07-5) YEAR TO MONTH
The following example shows a literal DATETIME value used with the EXTEND function:
EXTEND (DATETIME (2007-8-1) YEAR TO DAY, YEAR TO MINUTE)
   - INTERVAL (720) MINUTE (3) TO MINUTE