我的数据库中有一个字符串列,看起来像
07/12/2019 04:17:08 PM
我使用该功能
cast(from_unixtime(unix_timestamp(myfield, 'MM/dd/yyyy hh:mm:ss'),'yyyy-MM-dd HH:mm:ss') as timestamp)as mytime
这给了我的结果
2019-07-12 04:17:08.0
我希望结果是 UTC 格式,看起来像
2019-07-12 16:17:08.
如何将其更改为 UTC 格式?
使用 aaa
以日期时间解析 AM/PM。 默认情况下,from_unixtime
将其转换为yyyy-MM-dd hh:mm:ss
,其中小时部分为 24 小时格式。
from_unixtime(unix_timestamp(myfield, 'MM/dd/yyyy hh:mm:ss aaa'))