0

So I have been doing some work with postgreSQL and dealing with formatting the dates that I receive as an output from a simple query.

To run my query and return my list of dates I simply call something like:

select date from tablename;

This works well, and returns back to me a large list of dates in a format that is slightly off from my desired output.

Then after doing some research I discovered the function TO_CHAR(). This I had some success with again - I was able to call the function like so: select to_char(NOW(), 'Month dd, YYYY');

My question and where I have gotten stuck with some errors is how I might be able to pass in the results from the initial query into the to_char() function.

Apologies if this is a relatively basic question (I am a beginner when it comes to postgresql).

2
  • 1
    Can you add your original query to the question? Commented Oct 1, 2018 at 20:43
  • For client privacy reasons I would prefer not to. Hope you understand and that my intention with the question is clear. Commented Oct 1, 2018 at 20:48

1 Answer 1

1

As simple as the following:

select to_char(tablename.date, 'Month dd, YYYY') from tablename;
Sign up to request clarification or add additional context in comments.

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.