-
Varchar2(4) - Date
I have a column accounting_date varchar2(4) and populated with the value 0412,0402 etc. I need to convert it as a date like first two digits are year and last two digits are Month. the format I am looking is
Dec, 2004
Feb, 2004
I have used to_date(substr(accounting_date,-2)||substr(accounting_date,1,2),'MM-YY') query returns
1-Feb-2004
1-Dec-2004
Why I am getting DD?
Thanks.
-
Hi I think I have resolved this issue by using the below
substr(to_char(to_date(substr(accounting_date,-2)||substr(accounting_date,1,2),'MM/YY')),4,8).
Please correct if this is ok.
Thanks.
-
select to_date(a, 'YYMM') from x;
-
you dont want day then you have to modify your nls_date_format parameter or change back to char again
select to_char(to_date(a, 'RRMM'), 'MON-RR') from x
-
Hi Pando,
Thanks you for resolving the issue. Appreciate!!