1

Given a postgres table with a column that is a timestamp without time zone

 select "columnWithoutTimeZone" from my_table

Which results in:

 columnWithoutTimeZone
 Jun 11, 2022, 1:15:06 AM
 Jun 11, 2022, 1:15:06 AM

How can the date component of timestamp be extracted?

I tried

select to_date("columnWithoutTimeZone") from my_table

But this produced an error:

ERROR: function to_date(timestamp without time zone) does not exist

There is a similar stack question, but that deals with timezone conversions. I am simply trying to extract the Jun 11, 2022 that is presently represented in the column.

Thank you in advance for your consideration and response.

Ramón J Romero y Vigil
  • 17,373
  • 7
  • 77
  • 125

1 Answers1

3

Does this work for you?

select "columnWithoutTimeZone"::date from my_table
Bill Jetzer
  • 1,105
  • 4
  • 6