From: Tom Lane <tgl@sss.pgh.pa.us>
To: Henrik Pedersen <HenrikP@utp.dk>
Cc: pgsql-sql@hub.org
Subject: Re: [SQL] How to compare Datetime
Date: Sat, 17 Apr 1999 11:46:31 -0400
Message-ID: <23586.924363991@sss.pgh.pa.us> (raw)
In-Reply-To: <199904170300.XAA59609@hub.org>
Henrik Pedersen <HenrikP@utp.dk> writes:
> Im having some problems with the datetime fields
datetime is a date and time, not just a date. The behavior you describe
is all perfectly correct once you realize that your constants are being
interpreted as midnight of the given date.
If you only want to store the date, and not the time of day, your column
datatype should be "date" not datetime.
If you do want to store an exact time, then datetime is the right thing
to use. You can perform tests on it with one-day resolution by using
the date_part function to extract just the date. See the User's Guide.
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, HenrikP@utp.dk, pgsql-sql@hub.org
Subject: Re: [SQL] How to compare Datetime
In-Reply-To: <23586.924363991@sss.pgh.pa.us>
References: <199904170300.XAA59609@hub.org> <23586.924363991@sss.pgh.pa.us>
* 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