How do I convert a string which is actually a date with timezone to a timestamp in Presto?

后端 未结 1 1773
时光说笑
时光说笑 2021-01-25 00:24

Example : 2017-12-24 23:59:59.000 PST

This does not work

select date_parse(\'2017-12-24 23:59:59.000 PST\',\'%Y-%m-%d %T.%f %x\')

Sure

1条回答
  •  说谎
    说谎 (楼主)
    2021-01-25 00:55

    date_parse doesn't seem to support time zones, use parse_datetime instead:

    presto> select parse_datetime('2017-12-24 23:59:59.000 PST', 'YYYY-MM-dd HH:mm:ss.SSS z');
                        _col0
    ---------------------------------------------
     2017-12-24 23:59:59.000 America/Los_Angeles
    (1 row)
    

    0 讨论(0)
提交回复
热议问题