【发布时间】:2017-10-01 07:33:23
【问题描述】:
我参考了 psql documentation 并提出了这个查询。
SELECT to_timestamp('Tue Aug 30 2016 04:07:13 GMT+0530 (IST)', 'Dy MON DD YYYY HH24:MI:SS');
这个日期时间字符串 Tue Aug 30 2016 04:07:13 GMT+0530 (IST) 是我从 MongoDB printjson(createdAt) 得到的。
上面的 postresql 似乎不适用于所有偏移量。
我试过了
select to_timestamp('Tue Aug 30 2016 04:07:13 GMT+0530 (IST)', 'Dy MON DD YYYY HH24:MI:SS "GMT"OF "(IST)"');
但我收到此错误``错误:to_date` 不支持“TZ”/“tz”/“OF”格式模式。
如何将此字符串Tue Aug 30 2016 04:07:13 GMT+0530 (IST)转换为psql timestamptz格式?
【问题讨论】:
标签: sql postgresql timestamp-with-timezone