【问题标题】:Convert text column to timestamp将文本列转换为时间戳
【发布时间】:2017-02-15 20:40:44
【问题描述】:

目前,我已将 .csv 数据以以下格式(示例)上传到我的 Redshift 集群:

period_start            glance_view_count
2016/01/01 03:00 PST    0
2016/01/01 04:00 PST    800
2016/01/01 05:00 PST    100
2016/02/09 12:00 PST    99
2016/02/09 13:00 PST    18

period_start 当前是text 数据类型。

我想将此数据插入到单独的表中,其中period_start 列的格式为timestamptimestamptz。我可以调用TO_DATE() 函数或类似函数将text 转换为所需的格式吗?

【问题讨论】:

标签: sql amazon-redshift


【解决方案1】:

感谢另一位用户:http://docs.aws.amazon.com/redshift/latest/dg/r_TO_TIMESTAMP.html

SELECT to_timestamp(ios.period_start, 'yyyy/mm/dd HH:MI') as period_start 成功了!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-08-15
    • 2018-07-23
    • 1970-01-01
    • 2016-01-14
    • 1970-01-01
    • 2020-05-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多