Search Postgresql Archives

Re: comparing dates with timestamps ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2005-02-13 at 18:57 +0200, raptor wrote:
> how to compare dates with timestamp..if i dont care about 
> the hour:minute part of the timestamp... i.e. i want
> to be able to do exact match :
> 
> timestamp in (select date from table where .....)

Try something like this: (created is a timestamp data type)

 SELECT created::date FROM orders.payment WHERE id = 100;
  created
------------
 2004-11-28

or

SELECT id, email FROM orders.payment WHERE created::date = now()::date;

-Robby

-- 
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | robby@xxxxxxxxxxxxxxx
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
* --- Now hosting Ruby on Rails Apps ---
****************************************/


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux