1

I'm trying to convert the dates in my date column from:

yyyy-mm-dd

to

Month dd, yyyy

So far i've tried the below:

SELECT To_char(sq2.date_column, Month DD, YYYY)

but get the below error, despite my pattern aligning to the documentation

ERROR: syntax error at or near "DD"

I noticed in the documentation that To_char isn't explicitly referenced for date conversion (only time). Also, i'm not necessarily trying to alter the DATE type to VARCHAR. I would be happy to keep the data in the date_column as DATE type and just change the pattern.

0

2 Answers 2

1

You were damn close. Just missed the ' at the second parameter.

SELECT To_char('2018-01-20'::date, 'Month DD, YYYY')

Using your table column:

SELECT To_char(sq2.date_column, 'Month DD, YYYY')

Sign up to request clarification or add additional context in comments.

Comments

0

you have to use single code before month and end of the YYYY. you can use fallowing query for your required result
SELECT To_char(sq2.date_column, 'Month DD, YYYY')

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.