date is not equals to dia/month/year: what's wrong?

From: "Edipo E(dot) F(dot) Melo" <edipoelder(at)ig(dot)com(dot)br>
To: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: date is not equals to dia/month/year: what's wrong?
Date: 2000-09-26 16:25:01
Message-ID: 200009261627.e8QGRoN13678@hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi friends,

I was making a web app using Apache+PHP(4.0.1) and PostgreSQL
7.0.2, all running on OS/2 Warp FP12 (brazilian portuguese) and
discovered the following:

contas=> \d hipercard

Table "hipercard"
Attribute | Type |
Modifier

--------------+--------------+------------------------------------------
--------
------------
id_hipercard | integer | not null default
nextval('hipercard_id_hipercard_
seq'::text)
valor | money | not null
datacompra | date | not null
parcelas | integer | not null
descricao | varchar(240) |
Index: hipercard_pkey

contas=> select * from hipercard where id_hipercard=1;

id_hipercard | valor | datacompra | parcelas | descricao
--------------+---------+------------+----------+-----------
1 | $100.00 | 2000-04-30 | 1 |
(1 row)

contas=>select id_hipercard, valor, date_part('day', datacompra) as
"diaCompra", date_part('month', datacompra) as "mesCompra",
date_part('year', datacompra) as "anoCompra", parcelas, descricao from
hipercard where id_hipercard=1;

id_hipercard | valor | diaCompra | mesCompra | anoCompra | parcelas
|
descric
ao
--------------+---------+-----------+-----------+-----------+----------+
--------
---
1 | $100.00 | 29 | 4 | 2000 | 1
|
(1 row)

I'm doing something wrong? if the date is '2000-04-01', the
"frac-date-select" returns day: 31, month: 03, year 2000. More over:
'2000-01-01', splited: 31, 12, 1999.

[]'s

Edipo Elder F. de Melo

Browse pgsql-sql by date

  From Date Subject
Next Message Jie Liang 2000-09-26 17:41:20 Re: Data Type precision
Previous Message Danny 2000-09-26 12:06:52 Re: Re: [HACKERS] RFC - change of behaviour of pg_get_userbyid & pg_get_viewdef?