Date-Time Edit Mask Processing in Format and Search Buffers

Date-time edit masks can be used to describe the layout of a date/time field in format and search buffers. These edit masks can be used to convert values from the record into a date-time format you need. Unlike the other format buffer edit masks, date-time edit masks can also be used to update records.

For example, the following format buffer example produces output for field ND in DATE format:

...,ND,8,U,E(DATE).

If the field is defined in the FDT with format NATDATE, it will be converted in the record buffer to DATE format.

This document describes how Adabas handles date-time edit masks in format and search buffers.

A complete reference of the different date-time edit masks possible is provided in Date-Time Edit Mask Reference. Valid values range from 0001-01-00:00:00:00.000000 through 9999:12-31:23:59:59.999999 are allowed.

  • A value of zero (0) is allowed for those date-time edit masks where zero is nota valid value. In these cases, the meaning of the value zero is interpreted as "unknown." If the value is specified for an NC field, the significance indicator is set to "-1", independent of a significance indicator provided in the format or record buffer.

    If you try to convert a date-time edit mask with value zero (when zero represents an unknown date-time value) with another date-time edit mask, the result is always zero. If the target is an NC field, the significance indicator is set to "-1".

  • Dates before 1582 (when the Gregorian calendar was introduced) are handled as if the Gregorian calendar was valid also before 1582. Gregorian calendar leap year rules also apply.

Adabas allows you to add a date-time edit mask to any field with formats B, F, P, or U in a loaded file. However, the field may have values stored in the database which are not correct for the specified date-time edit mask. For compatibility reasons, Adabas uses the following processing rules:

  • If no date-time edit mask is given in the format or search buffer, no date-time conversions and checks are performed.

  • If a date-time edit mask is not compatible with the data-time edit mask in the field definition, an error is issued (response code 41, ADARSP041).

  • When specifying a date-time edit mask in the format buffer for a store or update command, the value is checked for a correct date-time value. If the field definition and the edit mask do not match, an error is issued (response code 55, ADARSP055).

  • If you specify a date-time edit mask in the format buffer for a read command and the field contains an invalid date-time value or the length of the field is not sufficient to store the value, an error is issued (response code 55, ADARSP055).

Depending on the format and length used for UNIXTIME and XTIMESTAMP fields, you may find that only a subset of the range between ) and 9999 years are supported:

  • With format B for UNIXTIME or XTIMESTAMP fields, you cannot store date-time values before 1970; this would require negative values that are not supported in binary (B) format.

  • Formt F with a length of 4 limits date-time values to January 19, 2038.

  • The maximum date for UNIX time is in the 23rd centry with format U and a length of 10.

Fields with date-time edit masks should not be used to store time intervals (ranges) because:

  • Zero (0) has a special meaning in date-time values.

  • Date-time conversions follow the rules of the underlying format and may return wrong results on interval values.

Date-time edit masks and the daylight saving indicator are not allowed in format selection criteria.