Re: Query on DATETIME for a date (the whole day) - Mailing list pgsql-novice

From Tom Lane
Subject Re: Query on DATETIME for a date (the whole day)
Date
Msg-id 21278.1319077947@sss.pgh.pa.us
Whole thread Raw
In response to Query on DATETIME for a date (the whole day)  (Basil Bourque <basil.list@me.com>)
List pgsql-novice
Basil Bourque <basil.list@me.com> writes:
> For a "timestamp with time zone" column, how do I find all rows where the value is within the beginning and ending of
asingle date? 

If you compare a date to a timestamp, the date is taken to mean midnight
of its day.  So you need something along the line of

    WHERE timestampcol BETWEEN dateval AND dateval+1

> And I'm concerned about local date time. I want to find by the user's local beginning and end of the day, not UTC.

Well, you're not being too clear about what you need here, but in what
I suggest above, "midnight" will be interpreted according to the current
"timezone" setting.

            regards, tom lane

pgsql-novice by date:

Previous
From: Basil Bourque
Date:
Subject: Query on DATETIME for a date (the whole day)
Next
From: Rikard
Date:
Subject: Can triggers update other tables?