如何在 HIVE 中将时间戳舍入到一天?

how to round timestamp to day in HIVE?

我有一个像 '2020-10-01T02:02:50.918+03:00' 这样的字符串值。如何获得这样的值:2020-10-01 00:00:00.000 in timestamp datatype in Hive?

使用 substr 获取 yyyy-MM-dd,然后使用时间戳构造。

演示:

select timestamp(substr('2020-10-01T02:02:50.918+03:00',1,10))

结果:

2020-10-01 00:00:00.0