DATETIME

The DATETIME data type stores an instant in time, expressed as a calendar date and time-of-day. You specify the time units that the DATETIME value stores; the precision can range from a year through a fraction of a second.

Data are stored as DECIMAL numbers that represent a contiguous sequence of values, each representing units of time. Its declaration uses this syntax:

4GLREF00000197.gif

The scale and precision specification is called the DATETIME qualifier. It uses a first TO last format to declare variables and screen fields.

You must substitute one or two of these keywords for the first and last terms:

Keyword
Corresponding Time Unit and Range of Values
YEAR
A year, numbered from 0001 (A.D.) to 9999.
MONTH
A month, numbered from 1 to 12.
DAY
A day, numbered from 1 to 31, as appropriate for its month.
HOUR
An hour, numbered from 0 (midnight) to 23.
MINUTE
A minute, numbered from 0 to 59.
SECOND
A second, numbered from 0 to 59.
FRACTION (scale)
A decimal fraction of a second, with a scale of up to five digits.
FRACTION
The default scale is three digits (thousandth of a second).
DATETIME Literals and Delimiters

Statements of 4GL can assign values to DATETIME data types. The simplest way to do this is as a DATETIME literal or as a character string. Both formats represent a specific DATETIME value as a numeric DATETIME value.

4GLREF00000198.gif