DATETIME Qualifier

Overview

Examples

Overview

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.

 

To specify only one unit of time as a qualifier, you need to specify as the first and in the last DAYTIME qualifier part, e.g. YEAR TO YEAR. It will cause an error, if you try to specify the time unit only once and omit the keyword TO.

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.

 

If you use a qualifier that begins with DAY and omits MONTH, you may receive unexpected results, in case the current month defined by system clock-calendar has fewer than 31 days. It is advisable not to use qualifiers with the DAY as the first part of the qualifier.

Examples

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)

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.