varchar timestamp :: date w/condition

PHOTO EMBED

Wed Feb 12 2025 17:48:06 GMT+0000 (Coordinated Universal Time)

Saved by @kastokes

select 
TO_CHAR(TO_TIMESTAMP(date, 'YYYY-MM-DD HH24:MI:SS'), 'YYYY-MM-DD') AS date_2

from 

where TO_TIMESTAMP(date_2, 'YYYY-MM-DD HH24:MI:SS')
      BETWEEN '2022-01-01'::DATE AND '2024-12-31'::DATE)
content_copyCOPY

when date is in varchar with timestamp and want to apply YYYY-MM-DD and then apply condition