給定一個帶有一列的 postgres 表timestamp without time zone
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列中當前表示的內容。
預先感謝您的考慮和回復。
uj5u.com熱心網友回復:
這對你有用嗎?
select "columnWithoutTimeZone"::date from my_table
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/497543.html
標籤:PostgreSQL
