X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 61ED4B430DB for ; Wed, 9 Jul 2003 22:40:00 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 13185-02 for ; Wed, 9 Jul 2003 19:39:29 -0300 (ADT) Received: from exchange.hq.openratings.com (unknown [141.149.165.226]) by svr1.postgresql.org (Postfix) with ESMTP id C9BBFB4388D for ; Wed, 9 Jul 2003 19:39:28 -0300 (ADT) Received: from openratings.com (cancun.hq.openratings.com [10.0.0.225]) by exchange.hq.openratings.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id NXY169HY; Wed, 9 Jul 2003 18:39:31 -0400 Message-ID: <3F0C99E5.4090205@openratings.com> Date: Wed, 09 Jul 2003 18:40:37 -0400 From: Dmitry Tkach User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Yasir Malik Cc: pgsql-sql@postgresql.org Subject: Re: Datatype conversion help References: <1057695693.24179.0.camel@localhost> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/112 X-Sequence-Number: 14226 What about lpad? select lpad (7, 2, 0) || '-' || lpad (9, 2, '0') || '-2003'; ?column? ------------ 07-09-2003 (1 row) I hope, it helps... Dima Yasir Malik wrote: >Thank you so much! But my problem is that when I do >to_char(mn, '00') || '-' || to_char(dy, '00') || '-' || to_char(yr, >'9999') > >where mn, dy, and yr are ints, is that the output has a space after the >the dash. For example, I get >07- 25- 1994 > >instead of what I want: >07-25-1994 > >Thanks, >Yasir > >On Tue, 8 Jul 2003, Richard Rowell wrote: > > > >>Date: 08 Jul 2003 15:21:33 -0500 >>From: Richard Rowell >>To: Yasir Malik >>Subject: Re: [SQL] Datatype conversion help >> >>On Tue, 2003-07-08 at 15:07, Yasir Malik wrote: >> >> >>>I've tried to_char(in_val, '99'), and that returns a string that is two >>> >>> >>select to_char(9,'00'); >> >> >> > >---------------------------(end of broadcast)--------------------------- >TIP 8: explain analyze is your friend > >