Re: formatting a date - Mailing list pgsql-general

From Zak McGregor
Subject Re: formatting a date
Date
Msg-id 20010510224627.54704fe5.zak@mighty.co.za
Whole thread Raw
In response to formatting a date  (Fran Fabrizio <ffabrizio@Exchange.WebMD.net>)
Responses Re: formatting a date  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Thu, 10 May 2001 15:30:01 -0400
Fran Fabrizio <ffabrizio@Exchange.WebMD.net> wrote:

>
> I'm looking all over the place in the Pg docs and Momjian book and
> having no luck finding any functions that would turn a timestamp such as
> 2001-05-08 23:59:59-04 into May 8, 2001.  (i.e. do what date_format()
> was doing for me in MySQL.)  Is there equivalent functionality in Pg?
>

You want to look at to_char().

To get May 10, 2001 you'd need to write something like:

select to_char(now(), 'Month dd, YYYY');

It pads the output of the month to 9 places, btw.

See
http://postgresql.readysetnet.com/users-lounge/docs/7.1/user/functions-formatting.html
 (watch for potential wrapping of the link)

for more info.

--
====================================================================
Zak McGregor
http://www.carfolio.com - Specifications of cars online. Over 7000!
--------------------------------------------------------------------
Of course my password is the same as my pet's name.
My macaw's name was Q47pY!3, but I change it every 90 days.
====================================================================

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: COPY locking
Next
From: Tom Lane
Date:
Subject: Re: NAMEDATALEN