我在Snowflake中工作,有一列时间戳格式如下:
timestamp
2021-12-13T21:52:58.656216349+0000
2021-12-13T18:22:01.194783523+0000
2021-12-13T21:03:55.224874997+0000
2021-12-13T21:02:37.075422427+0000
2021-12-13T15:54:26.268433672+0000
我所需的输出格式为:
2021-12-13
从过go 的问题中搜索,我找到了this answer个,并试图通过以下方式修改它以供我使用:
SELECT
timestamp AS original_ts,
to_timestamp(REPLACE(REPLACE(timestamp,'T',' '),'+',''),'YYYY-MM-DD') AS modified_ts
FROM
table
但会出现以下错误:
Can't parse '2022-01-26 00:06:11.1851022090000' as timestamp with format 'YYYY-MM-DD'
如何解决此错误并将时间戳列格式化为更熟悉的日期列,而完全忽略时间?