Unix Technical Forum

Re: CC Date format code defaults to current centry

This is a discussion on Re: CC Date format code defaults to current centry within the pgsql Bugs forums, part of the PostgreSQL category; --> Joe Brown wrote: > joe=> select to_date('19450323','CCYYMMDD'); > to_date > ------------ > 2045-03-23 > (1 row) > > joe=> ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Bugs

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 08:39 AM
Bruce Momjian
 
Posts: n/a
Default Re: CC Date format code defaults to current centry

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.

--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 08:39 AM
Andre Maasikas
 
Posts: n/a
Default Re: CC Date format code defaults to current centry

Bruce Momjian wrote:
> 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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:22 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com