oracle - Date Conversion from M20161 to Jan16 -
how convert m20161
jan-16
in oracle 2016
year , 1
month.
if "m"
literal going present, enclose in double quotes in format mask. since there no day part it'll default first day of month.
select to_date('m20161', '"m"yyyymm') res dual
result:
res --------- 01-jan-16
to display date in desired jan-16
format, use to_char()
function , mon-yy
format model.
select to_char(to_date('m20161', '"m"yyyymm'), 'mon-yy') res dual
result:
res ------ jan-16
Comments
Post a Comment