Re: Datatype conversion help - Mailing list pgsql-sql

From David Olbersen
Subject Re: Datatype conversion help
Date
Msg-id E7E213858379814A9AE48CA6754F5ECB0D6F76@mail01.stbernard.com
Whole thread Raw
In response to Datatype conversion help  (Yasir Malik <ymalik@cs.stevens-tech.edu>)
Responses Re: Datatype conversion help  (Yasir Malik <ymalik@cs.stevens-tech.edu>)
List pgsql-sql
Yasir,

If this is a date you're playing with, simply use:

to_char( <whatever date>, '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 <richard@bowmansystems.com>
> > To: Yasir Malik <ymalik@cs.stevens-tech.edu>
> > 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
>


pgsql-sql by date:

Previous
From: Michael A Nachbaur
Date:
Subject: Re: Datatype conversion help
Next
From: Yasir Malik
Date:
Subject: Re: Datatype conversion help