如何从 Presto 中的日期获取月份名称

How to get month name from date in Presto

我使用 Presto,但我不知道从日期列中获取 MONTH 名称的函数。我可以使用 MONTH(<date>) 函数获取 MONTH 编号,但我无法获取 MONTH 名称。

我见过手动创建月份名称列表并将数字与列表匹配以获得名称的方法。有没有更好的方法来使用 Presto 中的任何已知函数?

, Presto provides date_format function 与 MySQL 兼容。 %M 会告诉您时间戳的确切月份名称。例如:

SELECT date_format(timestamp '2017-11-21 12:00:00', '%M') month_name

使用 Presto ,您还可以使用以下功能:-

SELECT extract(MONTH from CURRENT_DATE) Month

输出看起来像:-