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 212D7B438AC for ; Tue, 8 Jul 2003 21:19:52 +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 56038-08 for ; Tue, 8 Jul 2003 18:19:41 -0300 (ADT) Received: from guinness.cs.stevens-tech.edu (guinness.cs.stevens-tech.edu [155.246.89.8]) by svr1.postgresql.org (Postfix) with ESMTP id 85604B4315C for ; Tue, 8 Jul 2003 18:19:40 -0300 (ADT) Received: by guinness.cs.stevens-tech.edu (Postfix, from userid 4405) id C17F4141692; Tue, 8 Jul 2003 17:19:42 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by guinness.cs.stevens-tech.edu (Postfix) with ESMTP id AD79E10A526; Tue, 8 Jul 2003 17:19:42 -0400 (EDT) Date: Tue, 8 Jul 2003 17:19:42 -0400 From: Yasir Malik To: David Olbersen Cc: pgsql-sql@postgresql.org Subject: Re: Datatype conversion help In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/91 X-Sequence-Number: 14205 Yes, Mr. Nachbaur helped me out. Thanks. I don't think I can do to_char(, 'MM-DD-YYYY) because the date fields are originally stored as separate integers in my schema (they have to be that way). I still can't understand why the extra space was added after the dash. It just made my life more miserable. Yasir On Tue, 8 Jul 2003, David Olbersen wrote: > Date: Tue, 8 Jul 2003 14:02:55 -0700 > From: David Olbersen > To: pgsql-sql@postgresql.org > Subject: Re: [SQL] Datatype conversion help > > Yasir, > > If this is a date you're playing with, simply use: > > to_char( , 'MM-DD-YYYY' ) > > to get what you want. > > -------------------------- > David Olbersen > iGuard Engineer > St. Bernard Software > 11415 West Bernardo Court > San Diego, CA 92127 > 1-858-676-2277 x2152 > > > > -----Original Message----- > > From: Yasir Malik [mailto:ymalik@cs.stevens-tech.edu] > > Sent: Tuesday, July 08, 2003 1:29 PM > > To: pgsql-sql@postgresql.org > > Subject: Re: [SQL] Datatype conversion help > > > > > > 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 > > > > ---------------------------(end of broadcast)--------------------------- > TIP 8: explain analyze is your friend >