From: Herouth Maoz <herouth@oumail.openu.ac.il>
To: Leslie Mikesell <les@Mcs.Net>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] parts of date_part()
Date: Thu, 27 Aug 1998 11:13:10 +0300
Message-ID: <l03110700b20ac18f7e5d@[147.233.159.109]> (raw)
In-Reply-To: <199808261653.LAA18509@Venus.mcs.net>
References: <l03110704b2097cbdee1a@[147.233.159.109]>
At 19:53 +0300 on 26/8/98, Leslie Mikesell wrote:
> Since I just ran across:
> psql=> select date_part('month','01-01-1998'::date);
> date_part
> ---------
> 12
> (1 row)
> and the extract() does the same in this case, I'm being a little cautious...
As a rule, I never use the type DATE, only DATETIME. I've seen too many
problems with timezones with the shorter types, and the functions
supporting them are too few for me to be comfortable with them.
My guess as to the reason of the above - and the Gurus may correct me if
I'm wrong - is that the DATE type does not contain time information. But
then, it is converted internally to DATETIME or milliseconds-since-epoch
for the sake of the function. This conversion involves your timezone, and
since you timezone is probably negative, a few hours before 1998-01-01 is
definitely December.
In my Postgres (Israeli Daylight Time):
testing=> select date_part( 'month', '01-01-1998'::date );
date_part
---------
1
(1 row)
Then again, it could be a platform problem. Have all the regression tests
passed correctly when you compiled?
Herouth
--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma
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: herouth@oumail.openu.ac.il, les@Mcs.Net
Subject: Re: [SQL] parts of date_part()
In-Reply-To: <l03110700b20ac18f7e5d@[147.233.159.109]>
References: <l03110704b2097cbdee1a@[147.233.159.109]> <l03110700b20ac18f7e5d@[147.233.159.109]>
* 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