我有一个包含以下列的表:
Store timezone date_entry date_exit
ABC America/Los Angeles 1/1/2019 16:17 1/4/2019 16:17
DEF Central Standard Time 2/1/2019 13:12 2/15/2019 09:45
所有date_entry和date_exit都位于UTC中,我想将其转换为timezone列中指定的所需时区。这只是一个示例,我具有多个时区的数据,并且进行硬编码非常麻烦且耗时。在Presto中,我可以从timezone列中输入此字符串以将时间偏移到所需的时区吗?
当前我正在这样做:
date_entry AT TIME ZONE 'America/Los_Angeles' AS date_entry
使用CASE WHEN语句,是否有一种方法可以使用时区列在Presto中在没有大小写的情况下执行此操作?
我研究了这些问题并尝试了预期的解决方案,但它对我不起作用:
1)Can you use a column for the timezone parameter of AT TIME ZONE in Presto / Athena?2)Presto SQL : Changing time zones using time zone string coming as a result of a query is not working
为此,Presto 320加上with_timezone
(对于with_timezone
值)timestamp
(对于at_timezone
值)。