Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extract Month From Date Field

I have a date field in a postgresql database (field name is input) how can I extract the month only from the date field? I used the syntax below, but I want it to show the actual month name, not a numeric value for the month

EXTRACT(MONTH FROM input) AS "Month"

So if the date in the field input was 04/26/2016 this syntax returns 4, how could I alter this to return April

like image 565
BobJonesGodfrey LovesToEatSush Avatar asked Apr 26 '16 15:04

BobJonesGodfrey LovesToEatSush


1 Answers

A simpler version.

to_char(input, 'Month') AS Month

Source : Data Type Formatting Functions

like image 129
Ram Avatar answered Oct 13 '22 09:10

Ram