1.1.13 DateTime

DateTime is a fixed-length field with a length of 19 (no fractional seconds) or between 21 and 29 (depending on number of positions after decimal point), containing a timestamp in ISO format: YYYY-MM-DD HH:MM:SS[.fffffffff]. If no length is specified, the length will default to 26, which is the most portable maximum length and the ISO default: YYYY-MM-DD HH:MM:SS.ffffff.

Internally, a DateTime field always contains a DateTime in UTC (Universal Coordinated Time). UTC is the modern term for GMT (Greenwich Mean Time). LANSA automatically converts to and from UTC when required. The DUTC and SUTC attributes are used to define whether the DateTime is displayed and stored in the database in UTC or local time.

The *NULL value is 1900-01-01 00:00:00

DateTime literals may be specified with or without a time zone.

The literal format without a time zone is known as the ISO format (described above). In the ISO format, the DateTime literal is in UTC, so this specifies the time in Greenwich, England, not the local time. Both seconds and fractional seconds portions are optional (will be set to zero if not provided). Note that as this format contains a space, it must be enclosed in single quotes to allow the editor to correctly identify it as a DateTime literal. For example: '2004-02-03 00:10:30'

The literal format with a time zone is known as ISO 8601. In the ISO 8601 format, the time zone is always specified with the data, either as a Z, meaning UTC, or +/-hh:mm, being the difference from UTC. To distinguish ISO 8601 from the standard ISO format, as well as the time zone value, the blank between the date and the time is replaced with a T. Fractional seconds are optional (will be set to zero if not provided). For example: 1900-01-01T00:00:00Z is the *NULL value. Another example is 1994-11-05T08:15:30-05:00, which corresponds to November 5, 1994, 8:15:30 am, US Eastern Standard Time (the time zone is 5 hours behind UTC). 1994-11-05T13:15:30Z corresponds to the same instant.

Please review the general 1.1.1 Field Type Considerations.

Field Definition Rules

Rules for defining DateTime fields in the repository are:


May be 19 or 21 to 29 in length. Default is 26. Decimals are automatically calculated (if 19, Decimals are 0, otherwise Decimals are Length - 20).

Valid Keyboard Shift


Allowed Attributes


Note: ISO display format must be selected.

Edit Mask

Not allowed.


*SQLNULL. ASQN will be enabled by default.

Field Definition Notes

Usage Rules

Partition Type

RDMLX Enabled Partition


DateTime fields may only be used in RDMLX Files. DateTimes may be used as real fields or keys. If used as key fields, take note of the Warning below.

Logical Views

Use of DateTimes as key fields is not recommended.

Virtual Fields

DateTimes may be used with Code Fragment Virtual Fields.

Predetermined Join Fields

Not allowed.

RDML Commands

DateTimes are classified as their own types and are not valid for numeric or alpha command parameters in RDML commands.

Built-In Functions

When used in Built-In Functions, Times are classified as their own types and are not valid for numeric or alpha arguments.

Special Values



Date fields may be converted to alpha, signed, packed, string or char. Refer to Field Type Conversions.

Usage Notes


Platform Considerations

Tips & Techniques

Also See

1.1.11 Date

1.1.12 Time