【问题标题】:Function needed to convert 2021-08-02T02:11:07.299+0000 to 2021-08-02 02:11:07.299 in Snowflake将 Snowflake 中的 2021-08-02T02:11:07.299+0000 转换为 2021-08-02 02:11:07.299 所需的函数
【发布时间】:2021-09-15 02:59:58
【问题描述】:

我正在通过 JSON 提取时区,其格式为 2021-08-02T02:11:07.299+0000。我想将时间戳转换为雪花 sql 中没有“T”的时间戳。谁能帮忙。

【问题讨论】:

  • 请编辑问题以将其限制为具有足够详细信息的特定问题,以确定适当的答案。

标签: timestamp snowflake-sql


【解决方案1】:

使用 to_timestamp-function 并指定数据的格式,中间是 T:

    select to_timestamp('2021-08-02T02:11:07.299+0000','YYYY-MM-DDTHH24:MI:SS.FF3+TZHTZM');

参考文档:

https://docs.snowflake.com/en/sql-reference/functions/to_timestamp.html https://docs.snowflake.com/en/sql-reference/functions-conversion.html#date-and-time-formats-in-conversion-functions

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-11-12
    • 1970-01-01
    • 2021-11-01
    • 2017-01-26
    • 1970-01-01
    • 2014-12-28
    • 2021-05-10
    • 1970-01-01
    相关资源
    最近更新 更多