Received: from www2.intellicast.com ([208.194.150.24]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eA7HJRs66606 for ; Tue, 7 Nov 2000 12:19:27 -0500 (EST) (envelope-from klcollins@wsicorp.com) Received: from wsicorp.com (ravens.wsicorp.com [147.81.80.26]) by www2.intellicast.com (980427.SGI.8.8.8/970903.SGI.AUTOCF) via ESMTP id MAA02618; Tue, 7 Nov 2000 12:18:55 -0500 (EST) Message-ID: <3A08397F.D2668498@wsicorp.com> Date: Tue, 07 Nov 2000 12:18:55 -0500 From: Kate Collins Organization: Weather Services International (WSI) Corporation X-Mailer: Mozilla 4.75 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Trouble Converting Dates Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200011/50 X-Sequence-Number: 81 Hi I am running postgres 7.02 on Linux and I am having trouble converting a character string to a date using the "to_date" function. For example: select to_char( to_date( '001112', 'YYMMDD'), 'YYYYMMDD'); to_char ---------- 00001112 In other words it is defaulting to the year 0 (actually year 1 BC, since there is no year 0) instead of 2000. Now I run the equivalent select statement on Oracle, and I get: select to_char( to_date( '001112', 'YYMMDD'), 'YYYYMMDD') from dual; TO_CHAR(TO_DATE('001112','YYMMDD'),'YYYYMMDD') --------------------------------------------------------------------------- 20001112 Which is what I expect. Is "YY" suppose to default to the current century or is this an Oracle'ism? I looked in my Postgres documents for a table describing the Date conversion strings, and could not find one. Is there a reference some one can direct me to? BTW, on postgres, when I try: select to_char( to_date( '20001112', 'YYYYMMDD'), 'YYYYMMDD'); I get the error: "ERROR: Unable to convert timestamp to date" Thanks, Kate -- ================================================= Katherine (Kate) L. Collins Senior Software Engineer/Meteorologist Weather Services International (WSI Corporation) 4 Federal Street Billerica, MA 01821 EMAIL: klcollins@wsicorp.com PHONE: (978) 670-5110 FAX: (978) 670-5100 http://www.intellicast.com