We help IT Professionals succeed at work.

In SQL, how do you format a date to give you the full month?

tmitch1968
tmitch1968 asked
on
Hello,

I have an SQL query that returns a date object.

I can get the query to return the month as an integer like this

to_char(item.ENTRY_DATE, 'MM') as Month

For example, a date with the month of September would be 09.

However, what I really need is for the month to be returned as its actual name - ie:  'September' or even 'Sep'

I've tried DATENAME, DATE_FORMAT, and a few other things.  None of these work.


Any suggestions?

Thanks in advance
Comment
Watch Question

Top Expert 2013
Commented:
TO_CHAR(item.ENTRY_DATE, 'MON') will return you the Abbreviated month name (like Sep, Nov)
TO_CHAR(item.ENTRY_DATE, 'MONTH') will return you the whole month name (like September, November)
Here is the list of all format models
HuaMin ChenProblem resolver
Commented:
Try
select to_char(sysdate,'Month') from dual;

Open in new window

Author

Commented:
Thanks!