Skip site navigation (1) Skip section navigation (2)

Re: How to filter on timestamps?

From: Mike Rylander <miker(at)purplefrog(dot)com>
To: "B(dot)W(dot)H(dot) van Beest" <bwvb(at)xs4all(dot)nl>
Subject: Re: How to filter on timestamps?
Date: 2004-07-07 03:28:30
Message-ID: ccfrjl$2po8$ (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
<posted & mailed>

B.W.H. van Beest wrote:

> I have a table where one of the columns is of type 'TIMESTAMP'
> How can I do a query to filter on the TIMESTAMP value, e.g. to obtain
> all rows earlier than a certain time stamp?

Think of the math opperators '<' and '>' as 'before' and 'after',
respectively.  ie:

SELECT * FROM table WHERE begin_date > '2004-07-06';

You can also use BETWEEN:

SELECT * FROM table WHERE update_timestamp BETWEEN '2004-07-01' AND

Remember that when timestamps are cast to dates, they are cast with
00:00:00.0 as the time part.

See the docs on this at and .

> Regards,

In response to

pgsql-sql by date

Next:From: David InglisDate: 2004-07-07 04:38:42
Subject: Help with sql statement grouping and distinct
Previous:From: B.W.H. van BeestDate: 2004-07-06 18:37:49
Subject: How to filter on timestamps?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group