Ask the Expert

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.

    Requires Free Membership to View

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.)

This was first published in October 2002

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: