The first part of the DATETIME qualifier contains the information about the largest unit of time used in the DATETIME value and the second part contains the information about the smallest one. The DATETIME qualifier has the following structure:
YEAR |
Specifies that years are used as the largest or the smallest time unit |
MONTH |
Specifies that months are used as the largest or the smallest time unit |
DAY |
Specifies that days are used as the largest or the smallest time unit |
HOUR |
Specifies that hours are used as the largest or the smallest time unit |
MINUTE |
Specifies that minutes are used as the largest or the smallest time unit |
SECOND |
Specifies that seconds are used as the largest or the smallest time unit |
FRACTION |
Specifies that fractions of a second are used as the largest or the smallest time unit |
Size |
An integer from 1 to 9 (in case of FRACTION from 1 to 5) that specifies the precision of the DATETIME qualifier |
The time unit in the last qualifier may be of the same size as the time unit in the first one, but it cannot be a larger time unit.
These are valid examples of qualifier usage:
DEFINE
dt_1 DATETIME YEAR TO HOUR
dt_2 DATETIME MONTH TO FRACTION
This is an invalid example of the qualifier usage which will produce an error when compiled:
DEFINE
d_time DATETIME HOUR TO YEAR
If a qualifier begins with MONTH and omits the year, 4GL uses the system date to supply any additional precision.
DEFINE
v_datetime_y_y DATETIME YEAR TO YEAR,
v_datetime_y_mo DATETIME YEAR TO MONTH,
v_datetime_y_d DATETIME YEAR TO DAY,
v_datetime_y_h DATETIME YEAR TO HOUR,
v_datetime_y_mi DATETIME YEAR TO MINUTE,
v_datetime_y_s DATETIME YEAR TO SECOND,
v_datetime_y_f DATETIME YEAR TO FRACTION,
v_datetime_y_f1 DATETIME YEAR TO FRACTION(1),
v_datetime_y_f2 DATETIME YEAR TO FRACTION(2),
v_datetime_y_f3 DATETIME YEAR TO FRACTION(3),
v_datetime_y_f4 DATETIME YEAR TO FRACTION(4),
v_datetime_y_f5 DATETIME YEAR TO FRACTION(5)