How can I change the DB2 default output format of DATE from the USA format (mm-dd-yyyy) to the ISO format (yyyy-mm-dd)?

Technote (FAQ)


Question

How can I change the DB2 default output format of DATE from the USA format (mm-dd-yyyy) to the ISO format (yyyy-mm-dd)?

Answer

The DB2® subsystem default for the output format of a DATE value is supplied when DB2 is installed: ISO, USA, EUR, JIS, or LOCAL. The default is ISO. The value of this DATE subsystem parameter is saved in the data-only load module, DSNHDECP. You cannot change this default.

However, you can change the output format of any given DATE value by using one of the following methods:

  • Apply the CHAR scalar function with the ISO format option. For example:

    SELECT CHAR(myDateCol,ISO) FROM myTable

  • If the DATE output is within an embedded SQL program, you can change the output format at bind time by setting the DATE precompiler option for SQL statement processing to ISO.

    To do this, use the DSNH command and specify DATE(ISO) as a DSNH CLIST parameter, as shown below:

    DSNH INPUT(data-set-name)
        ...
        DATE(ISO)
        ...

    You can also specify the DATE(ISO) option in the OTHER DSNH OPTIONS field on the DB2 Program Preparation panel.

Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

DB2 for z/OS
DB2 OS/390 Base

Software version:

7.0, 8.0

Operating system(s):

z/OS

Reference #:

1008141

Modified date:

2005-04-05

Translate my page

Machine Translation

Content navigation