MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

convert a date column from yyyynnn format to yyyy-mm-dd

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
moose
Beginner


Joined: 20 Aug 2003
Posts: 3
Topics: 1

PostPosted: Wed Aug 20, 2003 2:16 pm    Post subject: convert a date column from yyyynnn format to yyyy-mm-dd Reply with quote

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
View user's profile Send private message
moose
Beginner


Joined: 20 Aug 2003
Posts: 3
Topics: 1

PostPosted: Wed Aug 20, 2003 4:12 pm    Post subject: Reply with quote

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
View user's profile Send private message
moose
Beginner


Joined: 20 Aug 2003
Posts: 3
Topics: 1

PostPosted: Wed Aug 20, 2003 4:14 pm    Post subject: Reply with quote

sorry!that should be SELECT DATE(SUBSTR(DIGITS(date_field),a,b))
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group