Page 1 of 1

date format coverting

PostPosted: Mon Jan 31, 2011 11:52 am
by mfraj81
Hi all,

I have a field which stores the date in the format 'yyyymmdd'. I required to split it into 'yyyy-mm-dd'. Could you please let me help me with correct query?

Re: date format coverting

PostPosted: Mon Jan 31, 2011 11:54 am
by mfraj81
Hi all,

I have a field which stores the date in the format 'yyyymmdd'. I required to split it into 'yyyy-mm-dd'. Could you please help me with correct query?

Re: date format coverting

PostPosted: Mon Jan 31, 2011 8:51 pm
by alexm
You may try this - however, it might be time consuming, depending on how much data you're going to process:
SELECT SUBSTR(Colname,1,4) CONCAT '-' CONCAT
       SUBSTR(Colname,5,2) CONCAT '-' CONCAT
       SUBSTR(Colname,7,2)                 
FROM   your-table
WHERE  ... ;                               

Re: date format coverting

PostPosted: Tue Feb 01, 2011 4:24 pm
by mfraj81
Thank you it's working.