【发布时间】:2018-05-28 11:25:55
【问题描述】:
我正在运行以下查询:
select a.event_date,
date_format(date_trunc('month', a.event_date), '%m/%d/%Y') as date
from monthly_test_table a
order by 1;
输出:
2017-09-15 | 09/01/2017
2017-10-01 | 09/30/2017
2017-11-01 | 11/01/2017
谁能告诉我为什么在使用 date_trunc 后日期“2017-10-01”显示日期为“09/30/2017”。
在此先感谢...!
【问题讨论】:
-
您能否在问题中包含您想要的格式,这将有助于回答问题。
-
你能告诉我时区吗?
-
除了会话时区,
monthly_test_table的定义是什么——它是如何创建的,如何读取的。您使用的是 Hive 还是 Presto?