Andoy Abarquez
Andoy Abarquez

Reputation: 1149

How to get the month in the given date

I just want to get the Month in the given date

Ex. I have a list of date in my entity

01/02/2012
01/03/2012
03/01/2012

Upvotes: 2

Views: 130

Answers (3)

Adeel Aslam
Adeel Aslam

Reputation: 1294

If you want to get month number like 01 then try this

select to_char(date_val,'MM') from dual

For Mon try this

select to_char(date_val,'Mon') from dual

For Month try this

select to_char(date_val,'Month') from dual

Upvotes: 1

David Aldridge
David Aldridge

Reputation: 52336

To_Char(): http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions200.htm#SQLRF06129 Date Formats for To_Char(): docs.oracle.com/cd/E11882_01/server.112/e26088/sql_elements004.htm#i34510 Extract(): http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions059.htm#SQLRF00639

Upvotes: 0

Florin Ghita
Florin Ghita

Reputation: 17643

select to_char(date_value,'MM') from dual;
select to_char(date_value,'Mon') from dual;
select to_char(date_value,'Month') from dual;

?

Upvotes: 1

Related Questions