Re: comparing dates with timestamps ?

From: Robby Russell <robby(at)planetargon(dot)com>
To: raptor <raptor(at)tvskat(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: comparing dates with timestamps ?
Date: 2005-02-13 18:38:50
Message-ID: 1108319931.5245.92.camel@linus
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(at)planetargon(dot)com
* 503.351.4730 | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
* --- Now hosting Ruby on Rails Apps ---
****************************************/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bradley D. Snobar 2005-02-13 18:56:51 unsubscribe
Previous Message Bruce Momjian 2005-02-13 18:35:21 Re: [GENERAL] Website Documentation