user2656713
user2656713

Reputation: 31

Displaying date in Month DD,YYYY format

I want to display the date in below format

July 23, 2011 

SELECT REG_NO, FORMAT(DOB ,'YYYY/MM/DD') 
FROM Students ;

I tried below

SELECT REG_NO, FORMAT(DOB ,'MON DD,YYYY') 
FROM Students ;

It seems not working

Upvotes: 2

Views: 6204

Answers (3)

Naveen Kumar Alone
Naveen Kumar Alone

Reputation: 7668

use to_char

The syntax is to_char( value, [ format_mask ], [ nls_language ] )

SELECT REG_NO, TO_CHAR(DOB ,'MONTH DD,YYYY') FROM Students ;

Upvotes: 3

MaVRoSCy
MaVRoSCy

Reputation: 17839

The correct SQL is

SELECT REG_NO, to_char(DOB, 'MONTH DD, YYYY') FROM Students;

DD: Day Of Month

MONTH: Full Month Name

MM: Numeric Month

MON: Abbreviated Month, ex. Jul

YYYY: 4-DIGIT Year

For more on ORACLE date-format click here

Upvotes: 1

Conrad Lotz
Conrad Lotz

Reputation: 8818

How about trying this one:

SELECT REG_NO, to_char(DOB, 'FMMonth DD, YYYY') FROM Students;

TO_CHAR()

Upvotes: 1

Related Questions