How to convert 'dd-mm-yyyy' to 'dd-mmm-yyyy' in postgresql?

Member

by domenico , in category: MySQL , 9 months ago

How to convert 'dd-mm-yyyy' to 'dd-mmm-yyyy' in postgresql?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by haylee.mertz , 9 months ago

@domenico 

You can convert the date format from 'dd-mm-yyyy' to 'dd-mmm-yyyy' in PostgreSQL using the to_char() function. Here's an example query to achieve this:

1
2
SELECT to_char(your_date_column::date, 'DD-Mon-YYYY') AS new_date_format
FROM your_table_name;


Replace your_date_column with the column name containing the date value and your_table_name with your actual table name.


In the to_char() function, 'Mon' represents the abbreviated month name (e.g. Jan, Feb, Mar). You can also use 'Month' for the full month name (e.g. January, February, March).

Related Threads:

How to convert timestamp to yyyy-mm-dd hh24:mi:ss format in oracle?
How to convert yyyy-mm-dd hh:mm:ss to hh:mm:ss in mysql?
How to convert strings to a 'mm/dd/yyyy' format in teradata?
How set the datepicker in moment.js to yyyy-mm-dd?
How to insert date in yyyy-mm -dd hh24:mi:ss in oracle?
How to combine three variables into a date (mm/dd/yyyy) in teradata?