Problem solve Get help with specific problems with your technologies, process and projects.

Different date formats in CLP and Command Center

A column of type DATE is shown in different formats in the Command Line Processor and Command Center. In CLP it is MM/DD/YYYY (IBM USA standard), and in Command Center it is YYYY-MM-DD (ISO). What is the difference between the two? I get YYYY-MM-DD (ISO) format when I use JDBC. Please explain the difference in the format for Date.

DB2 stores date values using an internal representation. Any values whose data type is DATE, TIME or TIMESTAMP will be represented by character strings upon retrieval. The character string representation is normally the default format of date/time values associated with the country code of the database, unless overridden by specification of the DATETIME option when the program is precompiled or bound to the database. The CLP is a DB2 application program. My guess is that your default is ISO and the date/time format was changed for the CLP? Perhaps rebinding it would help.

You can always use the CHAR function to change a DATE value to a string representation in any DB2-supported format you wish (ISO, EUR, JIS, USA or LOC). So, using CHAR(DATE_COL, ISO) in the CLP when retrieving dates would cause your CLP dates to be the same as your dates elsewhere (Command Center, JDBC, etc.)

Dig Deeper on IBM DB2 management