Re: subtract a day from the NOW function - Mailing list pgsql-sql

From Fernando Hevia
Subject Re: subtract a day from the NOW function
Date
Msg-id 011701c7a943$d9463b30$8f01010a@iptel.com.ar
Whole thread Raw
In response to Re: subtract a day from the NOW function  (Michael Glaesemann <grzm@seespotcode.net>)
Responses Re: subtract a day from the NOW function  (Michael Glaesemann <grzm@seespotcode.net>)
List pgsql-sql
>> B) SELECT * FROM some_table WHERE to_char(some_timestamp,  
>> 'YYYYMMDD') >
>> to_char((now() - interval '1 day'), 'YYYYMMDD');
>
>I'd never use to_char to compare dates. The built-in comparison  
>operators work just fine.
>

Why not? I'm curious if has anything to do with performance or just style?
Any difference between:  ... WHERE to_char(my_date_col:date, 'YYYY.MM.DD') < '2007.06.07'
and  ... WHERE my_date_col:date < '2007.06.07'

Is there a 3rd better way to do this comparison?




pgsql-sql by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: subtract a day from the NOW function
Next
From: Steve Crawford
Date:
Subject: Re: subtract a day from the NOW function