From: | "Joel Burton" <joel(at)joelburton(dot)com> |
---|---|
To: | "Doug Silver" <dsilver(at)urchin(dot)com>, "Tom Ansley" <tansley(at)law(dot)du(dot)edu> |
Cc: | <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: Date Formatting |
Date: | 2002-05-06 14:22:17 |
Message-ID: | JGEPJNMCKODMDHGOBKDNIEPHCMAA.joel@joelburton.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
> -----Original Message-----
> From: pgsql-novice-owner(at)postgresql(dot)org
> [mailto:pgsql-novice-owner(at)postgresql(dot)org]On Behalf Of Doug Silver
> Sent: Friday, May 03, 2002 5:06 PM
> To: Tom Ansley
> Cc: pgsql-novice(at)postgresql(dot)org
> Subject: Re: [NOVICE] Date Formatting
>
>
> Hi Tom -
>
> select cast (now() as date) as date;
> date
> ------------
> 2002-05-03
>
> Depending on your application (e.g. perl/php script), that output is easy
> enough change it around to what you want or you could certainly write a
> function to do it -- something I have yet to do! I think such a function
> would be fairly easy to do since you're just rearranging the
> output, but doesn't everything look easy at the outset? You didn't
> mention the context of what you need this for, so there are lots of ways
> to do this.
>
> -doug
>
> On Fri, 3 May 2002, Tom Ansley wrote:
>
> > I am writing timestamps to file and the formatting is currently
> 2002-06-06
> > 00:00:00.0. Is there a function to only write the date and
> also to format it
> > something like MM/dd/yyyy ?
> >
> > Thanks
> >
> > Tom
More generically, look at the docs for to_char(), which is very flexible
formatting for date fields (& other types, too)
- J.
Joel BURTON | joel(at)joelburton(dot)com | joelburton.com | aim: wjoelburton
Knowledge Management & Technology Consultant
From | Date | Subject | |
---|---|---|---|
Next Message | Joshua b. Jore | 2002-05-06 15:49:51 | Re: Triggers in the db |
Previous Message | Joel Burton | 2002-05-06 14:20:43 | Re: |