给定一个列为timestamp without time zone
的postgres表
select "columnWithoutTimeZone" from my_table
结果是:
columnWithoutTimeZone
Jun 11, 2022, 1:15:06 AM
Jun 11, 2022, 1:15:06 AM
如何提取时间戳的日期成分?
我试着
select to_date("columnWithoutTimeZone") from my_table
但是产生了一个错误:
ERROR: function to_date(timestamp without time zone) does not exist
有一个类似的堆栈问题,但它处理的是时区转换。我只是想提取当前在列中表示的Jun 11, 2022
。
事先感谢您的考虑和答复。
这对你有用吗?
select "columnWithoutTimeZone"::date from my_table