Re: Date 1973/06/03 Conversion Problem in 7.3.4 and 7.3.2.

From: Torello Querci <querci(at)negens(dot)com>
To: Theodore Petrosky <tedpet5(at)yahoo(dot)com>
Cc: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Date 1973/06/03 Conversion Problem in 7.3.4 and 7.3.2.
Date: 2003-09-10 15:44:13
Message-ID: 1063208653.7332.8.camel@portatiletoro.negens.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

My problem is related to the insert a date in a database having a date
as text. With your suggestion I use the database to convert a string to
another string.

I make another test using the function to_timestamp with this result:

gturn2=> select to_timestamp('1973/06/03','yyyy/mm/dd');
to_timestamp
------------------------
1973-06-02 23:00:00+01
(1 row)

gturn2=> select to_timestamp('1973/06/02','yyyy/mm/dd');
to_timestamp
------------------------
1973-06-02 00:00:00+01
(1 row)

gturn2=> select to_timestamp('1973/06/04','yyyy/mm/dd');
to_timestamp
------------------------
1973-06-04 00:00:00+02
(1 row)

I suppose that the problem is related to how the daylight (??) is
managed. Using this function is possible to use this workaround:

gturn2=> select (to_timestamp('1973/06/03','yyyy/mm/dd')+'6
hours'::interval)::date;
date
------------
1973-06-03
(1 row)

but is only a workaround.

Il mer, 2003-09-10 alle 17:34, Theodore Petrosky ha scritto:
> I think this is what you wanted.
>
> select to_char('03/06/1973'::date,'dd/mm/yyyy');
>
> you were casting the string to a date and returning a
> date. so it would return it in a format that your
> system is set to return.
>
> agencysacks=# select
> to_char('03/06/1973'::date,'dd/mm/yyyy');
> to_char
> ------------
> 06/03/1973
> (1 row)
>
>
>
> Ted
>
> --- Karel Zak <zakkr(at)zf(dot)jcu(dot)cz> wrote:
> > On Wed, Sep 10, 2003 at 12:52:22PM +0200, Torello
> > Querci wrote:
> > > Hi to all,
> > >
> > > I have a problem storing 1973/06/03 date.
> > >
> > > If I send this statement
> > >
> > > select to_date('03/06/1973','dd/mm/yyyy');
> > >
> > > in the psql interface I obtain
> > >
> > > to_date
> > > ------------
> > > 1973-06-02
> > >
> > > I test this statement with Postgres 7.3.2 and
> > 7.3.4 packaged withMandrake 9.1
> > > and Mandrake 9.2RC1 and obtain the same result.
> > >
> > > Can anyone help me?
> >
> > What's happen if you try:
> >
> > test=# select '03/06/1973'::date;
> > date
> > ------------
> > 1973-06-03
> >
> >
> > --
> > Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
> > http://home.zf.jcu.cz/~zakkr/
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 7: don't forget to increase your free space map settings
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
--
Ing. Torello Querci
Responsabile Architetture Software
Negens S.r.l.

Tel. +39-055-5352846/7
e-mail: querci(at)negens(dot)com

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2003-09-10 16:25:38 Re: Date 1973/06/03 Conversion Problem in 7.3.4 and 7.3.2.
Previous Message Theodore Petrosky 2003-09-10 15:34:20 Re: Date 1973/06/03 Conversion Problem in 7.3.4 and 7.3.2.