to_date confusion

From: Richard Rowell <richard(at)rowell(dot)info>
To: pgsql-sql(at)postgresql(dot)org
Subject: to_date confusion
Date: 2003-01-07 03:58:35
Message-ID: 1041911915.2836.1.camel@workstation
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I'm confused. How do I get the integer 10102 to come in as the date
2002-01-01?

cmi=> select to_date('010102','MMDDYY');
to_date
------------
2002-01-01
(1 row)

cmi=> select to_char(10102,'000000');
to_char
---------
010102
(1 row)

cmi=> select to_date(to_char(10102,'000000'),'MMDDYY');
to_date
------------
2010-01-10
(1 row)

TIA!

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tambet Matiisen 2003-01-07 08:46:36 Re: Sorry, to many clients already
Previous Message Gary Stainburn 2003-01-06 22:29:47 Re: sub-select, view and sum()