Search code examples
sqloraclesqldatetime

how to convert date into month number?


I have a column Month in my table. The month name and date are stored in this month column like

Month    
01-JAN-12 
02-FEB-12 

and so on.

How do I convert the DATE into month number such as

Month
1 
2 

etc.


Solution

  • select 
    to_char(to_date('01-JAN-12','dd-mon-yy'),'mm') from dual;