Re: Date problem

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: josh(at)agliodbs(dot)com
Cc: sqllist <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Date problem
Date: 2000-09-29 06:24:23
Message-ID: 16319.970208663@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

>> Ok. Let's work. I posted a mail before explaining a strange
>> cituation if my Postgresql: when I use date_part() function to split
>> day, month and year of a date type column, it returns one day before.
>> In other words, '2000-01-01' returns day: 31, month:12, year: 1999.

> No problem here. Or on PG-ACCESS.

There's a known (and fixed for 7.1) bug of this sort that occurs on
spring daylight-savings-time transition days: the date-to-timestamp
conversion function picks the wrong timezone offset to interpret
"midnight" in, yielding a timestamp for 11PM of the prior date.
On the fall DST date, you get a timestamp for 1AM. For example,
in USA zones:

play=> select '2000-04-02'::date::timestamp;
?column?
------------------------
2000-04-01 23:00:00-05
(1 row)

play=> select '2000-10-29'::date::timestamp;
?column?
------------------------
2000-10-29 01:00:00-04
(1 row)

Not sure how this would apply to 2000-01-01, though. What timezone
are you in, anyway?

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Chau, Artemis 2000-09-29 15:15:45 invoke an external shell script from a function
Previous Message Josh Berkus 2000-09-29 05:41:15 Re: Date problem