从时间戳列 postgresql 中获取月份名称

时间:2021-03-28 03:10:57

标签: postgresql

我想获得每月的贷款数量,但我找不到将时间戳更改为月份名称的方法,每次都出现错误...

这是桌子 enter image description here

1 个答案:

答案 0 :(得分:3)

如果您要查找月份的英文名称,可以使用 to_char 从时间戳中获取:

SELECT to_char(created, 'Month')

这是今天的样子:

SELECT to_char(now(), 'Month') as month;
   month
-----------
 March
(1 row)