pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Edipo E. F. Melo <edipoelder@ig.com.br>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: date is not equals to dia/month/year: what's wrong?
Date: Tue, 26 Sep 2000 13:25:01 -0300 (ADT)
Message-ID: <200009261627.e8QGRoN13678@hub.org> (raw)

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




Message-ID: <200009261627.e8QGRoN13678@hub.org>
Permalink:  ../200009261627.e8QGRoN13678@hub.org/
Also on:    postgresql.org/message-id/200009261627.e8QGRoN13678@hub.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: edipoelder@ig.com.br
  Subject: Re: date is not equals to dia/month/year: what's wrong?
  In-Reply-To: <200009261627.e8QGRoN13678@hub.org>
  References: <200009261627.e8QGRoN13678@hub.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox