is there any way to convert dates in the long-format ‘September 21, 2022’ to just standard DD/MM/YYYY formats?
Question posted in PostgreSQL
The official documentation can be found here.
The official documentation can be found here.
is there any way to convert dates in the long-format ‘September 21, 2022’ to just standard DD/MM/YYYY formats?
2
Answers
You can change the format by changing the number of the format you need , 103 or else .
You can use
to_date()
to convert the string to a date:This returns a proper
date
value – the formatting depends on the SQL client displaying that value. If you just want to use it in your code, then keep it as a date. If you really do need to format that date back into a string (because e.g. your SQL client uses a format you don’t like and can’t change), then you can useto_char()
on that result: