Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 4938D9FBF4A for ; Thu, 7 Jun 2007 17:38:41 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 98411-06 for ; Thu, 7 Jun 2007 17:38:32 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from pyxis.powervt.com.ar (host3.powervt.com.ar [200.43.63.66]) by postgresql.org (Postfix) with ESMTP id 0DE6E9FBC06 for ; Thu, 7 Jun 2007 17:38:36 -0300 (ADT) Received: from pcfhevia ([201.216.249.98]) by pyxis.powervt.com.ar (IPGroup Mail Server) with ESMTP id 1OT48953; Thu, 07 Jun 2007 17:38:33 -0300 From: "Fernando Hevia" To: "'Michael Glaesemann'" Cc: Subject: Re: subtract a day from the NOW function Date: Thu, 7 Jun 2007 17:38:47 -0300 Organization: IP-TEL Message-ID: <011701c7a943$d9463b30$8f01010a@iptel.com.ar> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: AcepMNbDdP/zFts6QF6Zno5hYbfg8QAEbU0Q X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/67 X-Sequence-Number: 28557 >> 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?