dbTalk Databases Forums  

[BUGS] CC Date format code defaults to current centry

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


Discuss [BUGS] CC Date format code defaults to current centry in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Joe Brown
 
Posts: n/a

Default [BUGS] CC Date format code defaults to current centry - 03-13-2005 , 08:08 PM






joe=> select to_date('19450323','CCYYMMDD');
to_date
------------
2045-03-23
(1 row)

joe=> select to_date('19450323','YYYYMMDD');
to_date
------------
1945-03-23
(1 row)

I thought the former would be "more" correct. But it seems I am mistaken.

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply With Quote
  #2  
Old   
Bruce Momjian
 
Posts: n/a

Default Re: [BUGS] CC Date format code defaults to current centry - 03-13-2005 , 08:30 PM






Joe Brown wrote:
Quote:
joe=> select to_date('19450323','CCYYMMDD');
to_date
------------
2045-03-23
(1 row)

joe=> select to_date('19450323','YYYYMMDD');
to_date
------------
1945-03-23
(1 row)

I thought the former would be "more" correct. But it seems I am mistaken.
Uh, 1945 _is_ in the 20th century, but I can see how it is confusing.

--
Bruce Momjian | http://candle.pha.pa.us
pgman (AT) candle (DOT) pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster


Reply With Quote
  #3  
Old   
Andre Maasikas
 
Posts: n/a

Default Re: [BUGS] CC Date format code defaults to current centry - 03-14-2005 , 05:14 AM



Bruce Momjian wrote:
Quote:
Joe Brown wrote:

joe=> select to_date('19450323','CCYYMMDD');
to_date
------------
2045-03-23
(1 row)

joe=> select to_date('19450323','YYYYMMDD');
to_date
------------
1945-03-23
(1 row)

I thought the former would be "more" correct. But it seems I am mistaken.


Uh, 1945 _is_ in the 20th century, but I can see how it is confusing.

Yes, but the other way around: to_date('19450323','CCYYMMDD')
shoold be a year in the 19th century?

ps another db seems to disallow CC on input - maybe because one can
get into weird situations like to_date('2005 18','YYYY CC') or something
similar.

Andre


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend


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.