Re: Date problem - Mailing list pgsql-sql

From Tom Lane
Subject Re: Date problem
Date
Msg-id 16319.970208663@sss.pgh.pa.us
Whole thread Raw
In response to Re: Date problem  (Josh Berkus <josh@agliodbs.com>)
List 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


pgsql-sql by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Date problem
Next
From: "Chau, Artemis"
Date:
Subject: invoke an external shell script from a function