How to compare dates in datetime fields in Postgresql?

后端 未结 4 797
太阳男子
太阳男子 2020-12-07 10:05

I have been facing a strange scenario when comparing dates in postgresql(version 9.2.4 in windows).
I have a column in my table say update_date with type \'timestamp w

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-07 10:12

    Use Date convert to compare with date: Try This:

    select * from table 
    where TO_DATE(to_char(timespanColumn,'YYYY-MM-DD'),'YYYY-MM-DD') = to_timestamp('2018-03-26', 'YYYY-MM-DD')
    

提交回复
热议问题