RE: DATE_PART() BUG? We have an SQL statement that is giving wro ng output.

From: Peter Kelly <pkelly(at)ETS(dot)NET>
To: "'lockhart(at)fourpalms(dot)org'" <lockhart(at)fourpalms(dot)org>, pgsql-bugs(at)postgresql(dot)org
Cc: "'gord(at)jdp(dot)com'" <gord(at)jdp(dot)com>
Subject: RE: DATE_PART() BUG? We have an SQL statement that is giving wro ng output.
Date: 2001-05-25 15:03:46
Message-ID: 81568ACE3F6BD41189D90050046EB17A093E01@bart.int.ets.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thanks! That did it:

tbs=# SELECT DATE_PART('DAY', CAST('04/1/2001' AS DATE)) as dayofmonth;
dayofmonth
------------
31
(1 row)

tbs=# SET TIMEZONE = 'GMT' ;
SET VARIABLE
tbs=# SELECT DATE_PART('DAY', CAST('04/1/2001' AS DATE)) as dayofmonth;
dayofmonth
------------
1
(1 row)

Thanks for the quick response.

> -----Original Message-----
> From: Thomas Lockhart [mailto:lockhart(at)fourpalms(dot)org]
> Sent: Friday, May 25, 2001 9:45 AM
> To: pkelly(at)ets(dot)net; pgsql-bugs(at)postgresql(dot)org
> Subject: Re: DATE_PART() BUG? We have an SQL statement that is giving
> wrong output.
>
>
> > Short Description
> > DATE_PART() BUG? We have an SQL statement that is giving
> wrong output.
> > tbs=# SELECT version();
> > -------------------------------------------------------------
> > PostgreSQL 7.0.2 on i686-pc-linux-gnu, compiled by gcc 2.96
> > Here is a simple example:
> > SELECT DATE_PART('DAY', CAST('04/1/2001' AS DATE)) as dayofmonth
> > ----------
> > 31
> > Why does April 1st display as May 31st?
>
> This is a known "feature" of 7.0.x (and earlier) on daylight savings
> time boundaries. You will see the problem go away if you set your time
> zone to GMT. Upgrade to 7.1.x.
>
> - Thomas
>

Browse pgsql-bugs by date

  From Date Subject
Next Message Jeff Boes 2001-05-25 15:10:01 Re: COPY with default values?
Previous Message Tom Lane 2001-05-25 14:33:41 Re: COPY with default values?