From: Michael A Nachbaur <mike@nachbaur.com>
To: Yasir Malik <ymalik@cs.stevens-tech.edu>
To: pgsql-sql@postgresql.org
Subject: Re: Datatype conversion help
Date: Tue, 8 Jul 2003 13:45:05 -0700
Message-ID: <200307081345.05009.mike@nachbaur.com> (raw)
In-Reply-To: <Pine.SGI.4.51.0307081625220.4193960@guinness.cs.stevens-tech.edu>
References: <Pine.SGI.4.51.0307081604030.4185018@guinness.cs.stevens-tech.edu>
<1057695693.24179.0.camel@localhost>
<Pine.SGI.4.51.0307081625220.4193960@guinness.cs.stevens-tech.edu>
http://www.postgresql.org/docs/view.php?version=7.3&idoc=1&file=functions-formatting.html#FU...
See the pattern modifier "FM". From the docs:
"FM prefix - fill mode (suppress padding blanks and zeroes)"
On Tuesday 08 July 2003 01:28 pm, 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 <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
--
/* Michael A. Nachbaur <mike@nachbaur.com>
* http://nachbaur.com/pgpkey.asc
*/
"He expanded his chest to make it totally clear that here
was the sort of man you only dared to cross if you had a
team of Sherpas with you. "
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: mike@nachbaur.com, ymalik@cs.stevens-tech.edu
Subject: Re: Datatype conversion help
In-Reply-To: <200307081345.05009.mike@nachbaur.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox