Re: Time Formatting

From: Andrew McMillan <andrew(at)catalyst(dot)net(dot)nz>
To: hodges(at)xprt(dot)net
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Time Formatting
Date: 2002-05-10 13:57:10
Message-ID: 1021039030.24698.8.camel@kant.mcmillan.net.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Fri, 2002-05-10 at 15:30, hodges(at)xprt(dot)net wrote:
> I have 3 queries and some php to run them. What I need is
> to display the time in a HH:MM am format. Doesn't need to
> be stored that way in the table?

Right, so instead of:

SELECT timestamp_field FROM mytable;

you want:

SELECT to_char( timestamp_field, 'HH12:MI am') FROM mytable;

And for lots more information, look at the docs:

>
> On 9 May 2002 at 20:55, Larry Rosenman wrote:
>
> > look at the to_char function on
> > http://www.lerctr.org/postgresql/functions-formatting.html
> >

Regards,
Andrew.
--
--------------------------------------------------------------------
Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St, Wellington
WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St
DDI: +64(4)916-7201 MOB: +64(21)635-694 OFFICE: +64(4)499-2267
Are you enrolled at http://schoolreunions.co.nz/ yet?

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Aarni Ruuhimäki / Megative Tmi / KYMI.com 2002-05-10 17:55:37 Re: Altering columns without losing data
Previous Message Oliver Elphick 2002-05-10 09:28:39 Re: Converting epoc number to timestamp