View previous topic :: View next topic |
Author |
Message |
moose Beginner
Joined: 20 Aug 2003 Posts: 3 Topics: 1
|
Posted: Wed Aug 20, 2003 2:16 pm Post subject: convert a date column from yyyynnn format to yyyy-mm-dd |
|
|
How do I convert a date column in a db2 table from yyyynnn format to yyyy-mm-dd format from within an sql query so that the column displays as yyyy-mm-dd?
I understand the DATE and SUBSTR functions need to be used.I am looking for the syntax of the statement.
Thanks |
|
Back to top |
|
 |
moose Beginner
Joined: 20 Aug 2003 Posts: 3 Topics: 1
|
Posted: Wed Aug 20, 2003 4:12 pm Post subject: |
|
|
hello,
found the solution to that question.
SELECT DATE(SUBSTR(DATE(date_field),a,b))
FROM TABLE
this converts yyyynnn to yyyy-mm-dd
thanks |
|
Back to top |
|
 |
moose Beginner
Joined: 20 Aug 2003 Posts: 3 Topics: 1
|
Posted: Wed Aug 20, 2003 4:14 pm Post subject: |
|
|
sorry!that should be SELECT DATE(SUBSTR(DIGITS(date_field),a,b)) |
|
Back to top |
|
 |
|
|