Re: Date Formatting - Mailing list pgsql-novice

From Joel Burton
Subject Re: Date Formatting
Date
Msg-id JGEPJNMCKODMDHGOBKDNIEPHCMAA.joel@joelburton.com
Whole thread Raw
In response to Re: Date Formatting  (Doug Silver <dsilver@urchin.com>)
List pgsql-novice
> -----Original Message-----
> From: pgsql-novice-owner@postgresql.org
> [mailto:pgsql-novice-owner@postgresql.org]On Behalf Of Doug Silver
> Sent: Friday, May 03, 2002 5:06 PM
> To: Tom Ansley
> Cc: pgsql-novice@postgresql.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@joelburton.com | joelburton.com | aim: wjoelburton
Knowledge Management & Technology Consultant


pgsql-novice by date:

Previous
From: "Joel Burton"
Date:
Subject: Re:
Next
From: "Joshua b. Jore"
Date:
Subject: Re: Triggers in the db