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

From Scott Marlowe
Subject Re: subtract a day from the NOW function
Date
Msg-id 46684A70.4080903@g2switchworks.com
Whole thread Raw
In response to Re: subtract a day from the NOW function  ("Campbell, Lance" <lance@uiuc.edu>)
Responses Re: subtract a day from the NOW function  (Steve Crawford <scrawford@pinpointresearch.com>)
List pgsql-sql
Campbell, Lance wrote:
> Michael,
> So based on your feedback would it be better to do option A or B below?
>
> 1) I have a timestamp field, "some_timestamp", in table "some_table".
> 2) I want to compare field "some_timestamp" to the current date - 1 day.
> I need to ignore hours, minutes and seconds.
>   
You might want to use date_trunc then:

select * from sometable where date_trunc('day',tiemstampfield) > 
date_trunc('day',now() - interval '1 day');

or something like that.


pgsql-sql by date:

Previous
From: "Campbell, Lance"
Date:
Subject: Re: subtract a day from the NOW function
Next
From: Michael Glaesemann
Date:
Subject: Re: subtract a day from the NOW function