Reputation: 31
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
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
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
Reputation: 8818
How about trying this one:
SELECT REG_NO, to_char(DOB, 'FMMonth DD, YYYY') FROM Students;
Upvotes: 1