Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   Data Types and Expressions >

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

Read syntax diagramSkip visual syntax diagramLiteral DATETIME:
 
                                                                            (1)
|--DATETIME--(--| Numeric Date and Time |--)--| DATETIME  Field Qualifier |-------|
 
Numeric Date and Time:
 
|--+-yyyy--+-----------------------------------------------------------------------+-+--|
   |       '- ---mo--+-----------------------------------------------------------+-' |
   |                 '- ---dd--+-----------------------------------------------+-'   |
   |                           '-space--hh--+--------------------------------+-'     |
   |                                        '-:--mi--+---------------------+-'       |
   |                                                 '-:--ss--+----------+-'         |
   |                                                          '-.--fffff-'           |
   +-mo--+-----------------------------------------------------------+---------------+
   |     '- ---dd--+-----------------------------------------------+-'               |
   |               '-space--hh--+--------------------------------+-'                 |
   |                            '-:--mi--+---------------------+-'                   |
   |                                     '-:--ss--+----------+-'                     |
   |                                              '-.--fffff-'                       |
   +-dd--+-----------------------------------------------+---------------------------+
   |     '-space--hh--+--------------------------------+-'                           |
   |                  '-:--mi--+---------------------+-'                             |
   |                           '-:--ss--+----------+-'                               |
   |                                    '-.--fffff-'                                 |
   +-hh--+--------------------------------+------------------------------------------+
   |     '-:--mi--+---------------------+-'                                          |
   |              '-:--ss--+----------+-'                                            |
   |                       '-.--fffff-'                                              |
   +-mi--+---------------------+-----------------------------------------------------+
   |     '-:--ss--+----------+-'                                                     |
   |              '-.--fffff-'                                                       |
   +-ss--+----------+----------------------------------------------------------------+
   |     '-.--fffff-'                                                                |
   '-fffff---------------------------------------------------------------------------'
 
Notes:
  1. See DATETIME Field Qualifier
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, in digits 0 ≤ fffff ≤ 9999 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 ≤ 11 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 You can specify up to 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 (97-3-6) YEAR TO DAY

DATETIME (09:55:30.825) HOUR TO FRACTION

DATETIME (97-5) YEAR TO MONTH

The following example shows a literal DATETIME value used with the EXTEND function:

EXTEND (DATETIME (1997-8-1) YEAR TO DAY, YEAR TO MINUTE)
   - INTERVAL (720) MINUTE (3) TO MINUTE
Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]