GL_DATE environment variable

The GL_DATE environment variable specifies custom display formats of values for DATE columns.

Important: GL_DATE is evaluated when it is used, rather than when it is set. If it is invalid, the operation that called it fails.
Read syntax diagramSkip visual syntax diagram
>>-GL_DATE--'string'--+---------------------------------------------------------------------------+-><
                      |                                 (1)                                   (2) |   
                      '-| Format qualifiers for reads |------| Format qualifiers for output |-----'   

Notes:
  1. See Field specification for reading a DATE value
  2. See Field specification for displaying a DATE value
Element
Description
string
Formatting directives that specify the display format for GL_DATE values. You can use any formatting directive that formats dates.
A display format in GL_DATE can contain the following characters:
  • One or more white space characters, which the CTYPE category of the locale specifies.
  • An ordinary character (other than the % symbol or a white-space character).
  • A formatting directive, which is composed of the % symbol followed by a conversion character that specifies the required replacement.
The following table lists the formatting directives that are not based on era.
Formatting directives Description
%a Is replaced by the abbreviated weekday name as defined in the locale.
%A Is replaced by the full weekday name as defined in the locale.
%b Is replaced by the abbreviated month name as defined in the locale.
%B Is replaced by the full month name as defined in the locale.
%C Is replaced by the century number (the year divided by 100 and truncated to an integer) as an integer (00 through 99).
%d Is replaced by the day of the month as an integer (01 through 31). A single digit is preceded by a zero (0).
%D Is the same as the %m/%d/%y format.
%e Is replaced by the day of the month as a number (1 through 31). A single digit is preceded by a space.
%h Is the same as the %b formatting directive.
%iy Is replaced by the year as a two-digit number (00 - 99) for both reading and printing. It is the formatting directive specific to IBM Informix for %y.
%iY Is replaced by the year as a four-digit number (0000 - 9999) for both reading and printing. It is the formatting directive specific to IBM Informix for %Y.
%m Is replaced by the month as a number (01 through 12).
%n Is replaced by a newline character.
%t Is replaced by the TAB character.
%w Is replaced by the weekday as a number (0 through 6); 0 represents the locale equivalent of Sunday.
%x Is replaced by a special date representation that the locale defines.
%y Requires that the year is a two-digit number (00 through 99) for both reading and printing.
%Y Requires that the year is a four-digit number (0000 through 9999) for both reading and printing.
%% Is replaced by % (to allow % in the format string).
White space or other nonalphanumeric characters must show between any two formatting directives. For example, if you use a U.S. English locale, you might want to format an internal DATE value for 03/05/1997 in the ASCII string format that the following example shows:
Mar 05, 1997 (Wednesday)
To do so, set the GL_DATE environment variable as follows:
%b %d, %Y (%A)
If a GL_DATE format does not correspond to any of the valid formatting directives, the behavior of the IBM Informix product when it tries to format is undefined.
Important: The setting of the DBDATE variable takes precedence over that of the GL_DATE environment variable and over the default DATE formats that CLIENT_LOCALE specifies.