DBDATE environment variable
Use the DBDATE environment variable to specify the end-user formats of DATE values.
The following formatting symbols are valid in the DBDATE setting:
- - . /
- are characters that can exist as separators in a date format.
- 0
- indicates that no separator is displayed between time units.
- D, M
- are characters that represent the day and the month.
- Y2, Y4
- are characters that represent the year and the precision of the year.
Some East Asian locales support additional syntax for era-based dates.
- The order of time units (the month, day, and year) in a date
- Whether the year is shown as two digits (Y2) or four digits (Y4)
- The separator between the month, day, and year time units
For the U.S. English locale, the default for DBDATE is MDY4/
,
where M
represents the month, D
represents
the day, Y4
represents a four-digit year, and slash
( / ) is the time-units separator (for example, 01/08/2011
).
Other valid characters for the separator are a hyphen ( - ),
a period ( . ), or a zero (0). To indicate no separator, use
the zero. The slash ( /
) is used by default
if you attempt to specify a character other than a hyphen, period,
or zero as a separator, or if you do not include any separator in
the DBDATE specification.
If DBDATE is not set
on the client, any DBDATE setting on the database server overrides
the MDY4/
default on the client. If DBDATE is
set on the client, that value (rather than the setting on the database
server) is used by the client.
DBDATE Setting | Representation of January 8, 2011: | DBDATE Setting | Representation of January 8, 2011: | |
---|---|---|---|---|
MDY4/ | 01/08/2011 | Y2DM. | 11.08.01 | |
DMY2- | 08-01-11 | MDY20 | 010811 | |
MDY4 | 01/08/2011 | Y4MD* | 2011/01/08 |
Y4MD
* (because asterisk is
not a valid separator) and MDY4
(with no separator
defined) both display the default symbol (slash) as the separator.
Also, certain routines that calls can use the DBTIME variable, rather than DBDATE, to set DATETIME formats to international specifications. For more information, see the discussion of the DBTIME environment variable in DBTIME environment variable and in the HCL OneDB™ ESQL/C Programmer's Manual.
The setting of the DBDATE variable takes precedence over that of the GL_DATE environment variable, and over any default DATE format that CLIENT_LOCALE specifies. For information about GL_DATE and CLIENT_LOCALE, see the HCL OneDB GLS User's Guide.
- When you display DATE values, HCL OneDB products use the DBDATE environment variable to format the output.
- During data entry of DATE values, HCL OneDB products use the DBDATE environment variable to interpret the input.
For example, if you specify a literal DATE value in an INSERT statement, the database server expects this literal value to be compatible with the format that DBDATE specifies. Similarly, the database server interprets the date that you specify as the argument to the DATE( ) function to be in DBDATE format.