dat.a.tho
dat.a.tho

Reputation: 49

Convert YYY-MM-DD to MON DD, YYYY in PostgreSQL

I am having difficulty converting dates in a column from YYYY-MM-DD to Mon DD, YYYY

I think I first need to reorganize the dates and then use a case when statement to specify 01 = Jan and so on? Is that correct?

SELECT to_date(column_name, 'MM/DD/YYYY') 
FROM table

gives me some incorrect dates i.e. previous = 2012-01-29 and result from query = 0197-06-26

Any suggestions? Thanks

Upvotes: 0

Views: 313

Answers (1)

dat.a.tho
dat.a.tho

Reputation: 49

I figured it out!

SELECT to_char(date(column_name), 'Mon dd, yyyy')
FROM table

gives me exactly what I need without the need of a case statement.

Upvotes: 1

Related Questions