From: Mike Rylander <miker@purplefrog.com>
To: B.W.H. van Beest <bwvb@xs4all.nl>
Subject: Re: How to filter on timestamps?
Date: Tue, 06 Jul 2004 23:28:30 -0400
Message-ID: <ccfrjl$2po8$1@news.hub.org> (raw)
References: <40eaf12a$0$48959$e4fe514c@news.xs4all.nl>
<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
'2004-07-06';
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
http://www.postgresql.org/docs/7.4/interactive/datatype-datetime.html and
http://www.postgresql.org/docs/7.4/interactive/functions-datetime.html .
--miker
>
> Regards,
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: miker@purplefrog.com, bwvb@xs4all.nl
Subject: Re: How to filter on timestamps?
In-Reply-To: <ccfrjl$2po8$1@news.hub.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox