DB2 changes the date format in terms of date representation, which is also a problem I often encounter. The default format for date is determined by the database region code, which is specified when the database is created. For example, if I use territory = US to define the region code when creating a database, the date format will look like the following: values current date www.2cto.com 1 ---------- 1 record (s) selected.
That is to say, the date format is MM/DD/YYYY. to change the format, bind a specific DB2 toolkit. other supported date formats include: DEF uses the date and time formats that match the region code. EUR uses the IBM standard format for European dates and times. ISO uses the date and time formats developed by the International Standards Organization (ISO. JIS uses the Japanese Industrial Standard date and time format. LOC uses the local date and time format that matches the database region code. USA uses the IBM standard format for date and time in the United States.
In Windows, to convert the default date and time format to ISO format (YYYY-MM-DD), perform the following operations: 1. In the command line, change the current directory to sqllib \ bnd. For example, in Windows: c: \ program files \ IBM \ sqllib \ bnd in UNIX:/home/db2inst1/sqllib/bnd 2. from the command line interface of the operating system, use a user with SYSADM permission to connect to the database: db2 connect to DBNAME www.2cto.com db2 bind @ db2ubind. lst datetime ISO blocking all grant public (in your actual environment, replace DBNAME and ISO with your database name and the date format you want to use .) Now, you can see that your database has used ISO as the date format: values current date 1 ---------- 1 record (s) selected. in Windows, convert the default date and time format to ISO format (YYYY-MM-DD), date (char (date ("2008/12/12 19:22:38"), iso )) db2 select char (current date, DEF) from org db2 select char (current date, EUR) from org db2 select char (current date, ISO) from org db2 select char (current date, JIS) from org db2 select char (current date, LOC) from org db2 select char (current date, USA) from org author ITPUByuanqingyu0123