Extract date (yyyy/mm/dd) from a timestamp in PostgreSQL

前端 未结 7 1500
南旧
南旧 2020-11-28 17:55

I want to extract just the date part from a timestamp in PostgreSQL.

I need it to be a postgresql DATE type so I can insert it into another table that e

7条回答
  •  广开言路
    2020-11-28 18:29

    Just do select date(timestamp_column) and you would get the only the date part. Sometimes doing select timestamp_column::date may return date 00:00:00 where it doesn't remove the 00:00:00 part. But I have seen date(timestamp_column) to work perfectly in all the cases. Hope this helps.

提交回复
热议问题