Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get month name from timestamp column postgresql

Tags:

postgresql

I wanna get the number of loans per month but I can't find a way to change the timestamp to month name, I get an error every time...

Here is the table enter image description here

like image 346
Marc Avatar asked Sep 06 '25 03:09

Marc


1 Answers

If you're looking for the English name of the month, you can get it from your timestamp using to_char:

SELECT to_char(created, 'Month')

This is what it looks like for today:

SELECT to_char(now(), 'Month') as month;
   month
-----------
 March
(1 row)
like image 127
Blue Star Avatar answered Sep 07 '25 19:09

Blue Star