dbTalk Databases Forums  

[BUGS] Date 1973/06/03 Conversion Problem in 7.3.4 and 7.3.2.

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] Date 1973/06/03 Conversion Problem in 7.3.4 and 7.3.2. in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Torello Querci
 
Posts: n/a

Default [BUGS] Date 1973/06/03 Conversion Problem in 7.3.4 and 7.3.2. - 09-10-2003 , 07:55 AM






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?

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Reply With Quote
  #2  
Old   
Pavel Stehule
 
Posts: n/a

Default Re: [BUGS] Date 1973/06/03 Conversion Problem in 7.3.4 and 7.3.2. - 09-10-2003 , 08:06 AM






On my 7.4 this select works fine

testdb011=> select to_date('03/06/1973','dd/mm/yyyy');
to_date
------------
1973-06-03

Pavel


On Wed, 10 Sep 2003, Torello Querci wrote:

Quote:
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?

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo (AT) postgresql (DOT) org)


Reply With Quote
  #3  
Old   
Theodore Petrosky
 
Posts: n/a

Default Re: [BUGS] Date 1973/06/03 Conversion Problem in 7.3.4 and 7.3.2. - 09-10-2003 , 12:23 PM



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.cz> wrote:
Quote:
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.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

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org


Reply With Quote
  #4  
Old   
Jord Tanner
 
Posts: n/a

Default Re: [BUGS] Date 1973/06/03 Conversion Problem in 7.3.4 and 7.3.2. - 09-10-2003 , 03:17 PM






This is not a bug, but simply due to postgres date formatting. Observe
thus:


gbi=# set datestyle to 'iso';
SET
gbi=# select to_date('03/06/1973','dd/mm/yyyy');
to_date
------------
1973-06-03
(1 row)

gbi=# set datestyle to 'us';
SET
gbi=# select to_date('03/06/1973','dd/mm/yyyy');
to_date
------------
1973-06-03
(1 row)

gbi=# set datestyle to 'sql';
SET
gbi=# select to_date('03/06/1973','dd/mm/yyyy');
to_date
------------
06/03/1973
(1 row)


datestyle can be permanently set in postgresql.conf, or by the
environment variable 'PG_DATESTYLE';

On Wed, 2003-09-10 at 03:52, Torello Querci wrote:
Quote:
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?

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
--
Jord Tanner <jord (AT) indygecko (DOT) com>


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings


Reply With Quote
  #5  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] Date 1973/06/03 Conversion Problem in 7.3.4 and 7.3.2. - 09-10-2003 , 11:17 PM



Jord Tanner <jord (AT) indygecko (DOT) com> writes:
Quote:
This is not a bug, but simply due to postgres date formatting.
Yes, it's a bug, but it's specific to the Europe/Rome timezone setting.
I've not yet had a chance to figure out the details.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly


Reply With Quote
  #6  
Old   
Torello Querci
 
Posts: n/a

Default Re: [BUGS] Date 1973/06/03 Conversion Problem in 7.3.4 and 7.3.2. - 09-13-2003 , 12:56 PM



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:
Quote:
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.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.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



---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org


Reply With Quote
  #7  
Old   
Torello Querci
 
Posts: n/a

Default Re: [BUGS] Date 1973/06/03 Conversion Problem in 7.3.4 and 7.3.2. - 09-13-2003 , 12:56 PM




On 7.3.2 and 7.3.4 obtain the same result:

template1=3D# select '03/06/1973'::date;
date
------------
1973-03-06
(1 row)

template1=3D# select '02/06/1973'::date;
date
------------
1973-02-06
(1 row)

template1=3D# select '06/03/1973'::date;
date
------------
1973-06-03
(1 row)

template1=3D# select '06/02/1973'::date;
date
------------
1973-06-02
(1 row)




I suppose that the problem is related to the timezone. I make this test:



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

template1=3D# select to_timestamp('1973/06/02','yyyy/mm/dd');
to_timestamp
------------------------
1973-06-02 00:00:00+01
(1 row)

template1=3D# select to_timestamp('1973/06/04','yyyy/mm/dd');
to_timestamp
------------------------
1973-06-04 00:00:00+02


Alle 15:33, mercoled=EC 10 settembre 2003, hai scritto:
Quote:
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 withMandra=
ke
9.1 and Mandrake 9.2RC1 and obtain the same result.

Can anyone help me?

What's happen if you try:

test=3D# select '03/06/1973'::date;
date
------------
1973-06-03
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.