Search code examples
sqlpostgresql

How to convert number to month name in PostgreSQL?


I m trying to convert string number to month name but i searched a lot of resources but it didn't help me.

here is my query

SELECT CAST(extract('month'
                    FROM to_date(proforma_invoice_date, 'DD/MM/YYYY')) AS VARCHAR) AS proforma_invoice_date
FROM proforma_invoice

Here is my output...

enter image description here


Solution

  • Use to_char():

    to_char(to_date(proforma_invoice_date, 'DD/MM/YYYY'), 'Month')