Re: BUG #1458: to_char is crazy

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Tomás Zandoná <tdzandona(at)yahoo(dot)com(dot)br>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1458: to_char is crazy
Date: 2005-02-03 05:40:31
Message-ID: 20050203054031.GA27145@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Feb 02, 2005 at 12:27:53AM +0000, Tomás Zandoná wrote:

Hey Tomás,

> I dont't know if it's a bug, but I insert the date 2005-10-09 in a Date
> field.
> Later I execute:
>
> select to_char(day, 'DD/MM/YYYY') from test_table;
>
> It returns 08/10/2005.
>
> ????? I don't understand why it returns 08 instead of 09...

Is the column of type timestamp or something similar? If so, probably
you are being bitten by a timezone problem. If you want just a date,
declare the column with type date.

--
Alvaro Herrera (<alvherre[(at)]dcc(dot)uchile(dot)cl>)
Bob [Floyd] used to say that he was planning to get a Ph.D. by the "green
stamp method," namely by saving envelopes addressed to him as 'Dr. Floyd'.
After collecting 500 such letters, he mused, a university somewhere in
Arizona would probably grant him a degree. (Don Knuth)

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2005-02-03 06:02:01 Re: BUG #1455: pg_dumpall fails
Previous Message Kris Jurka 2005-02-02 09:39:01 timezone offsets and documentation