EGL date-and-time types

The next table lists the simple date-and-time types, all of which are value types.

Type Limits Comments
DATE 1 January 0001

to 31 December 9999.

Each Date value reflects the following pattern: yyyyMMdd; that is, four digits for year, two for month, and two for day, in the Gregorian calendar.
INTERVAL types // ???? max number of days seems to be 283067, despite the use of nine d characters; and the yyyyMM form fails altogether.

Not implemented in Eclipse IDE for EGL Developers.

An instance of type INTERVAL is a duration; for example, the difference between two timestamps.

An INTERVAL value is stored along with a type pattern, which gives details on the specific INTERVAL type. An example pattern is ddddHHss; in this case, four digits for day, two for hour, and two for second.

You specify the pattern when you declare a field of an INTERVAL type, as shown here:
myInterval INTERVAL("ddddHHss");
TIME

12:00:00 AM to 11:59:59 PM.

Stored TIME values reflect the following pattern: HHmmss; that is, two digits for hour, two for minute, and two for second.
At this writing, this type is not supported for the following purposes:
  • To access a relational database.
  • To access a host program on IBM i.
  • To read or write a JSON string in code generated for Java.
TIMESTAMP types 1 January 0001 at 12:00:00 AM

to 31 December 9999 at 11:59:59 PM.

TIMESTAMP values are stored along with a type pattern. The default pattern is yyyyMMddHHmmss, which is a concatenation of the type patterns for DATE and TIME.
You can specify a type pattern when you declare a field of a TIMESTAMP type, as shown here:
myTimestamp TIMESTAMP("ddHHmmssffffff");

The last six characters refer to digits for microseconds.

Here are the main rules for interacting with fields of the date-and-time types:

For details, see “Patterns for date-and-time fields.”

Compatibility considerations

Platform Issue
JavaScript generation
  • The INTERVAL types are not supported.
  • When you assign a field of type DATE, TIME, or TIMESTAMP to a field of a character type, only a subset of the display-pattern characters is available. Those limits are relevant when you use any of the following system functions: 
    • StrLib.formatDate
    • StrLib.formatTime
    • StrLib.formatTimestamp.
    For details, see “Patterns for date-and-time fields.”