Re: Datatype conversion help

From: Yasir Malik <ymalik(at)cs(dot)stevens-tech(dot)edu>
To: David Olbersen <DOlbersen(at)stbernard(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Datatype conversion help
Date: 2003-07-08 21:19:42
Message-ID: Pine.SGI.4.51.0307081715130.4138513@guinness.cs.stevens-tech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Yes, Mr. Nachbaur helped me out. Thanks. I don't think I can do
to_char(<whatever date>, '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 <DOlbersen(at)stbernard(dot)com>
> To: pgsql-sql(at)postgresql(dot)org
> Subject: Re: [SQL] Datatype conversion help
>
> 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(at)cs(dot)stevens-tech(dot)edu]
> > Sent: Tuesday, July 08, 2003 1:29 PM
> > To: pgsql-sql(at)postgresql(dot)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(at)bowmansystems(dot)com>
> > > To: Yasir Malik <ymalik(at)cs(dot)stevens-tech(dot)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
> >
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Rudi Starcevic 2003-07-08 23:52:07 Logging select statements
Previous Message David Olbersen 2003-07-08 21:02:55 Re: Datatype conversion help