Re: Re: Time Formats

From: "Robert B(dot) Easter" <reaster(at)comptechnews(dot)com>
To: Jeffery L Post <postjeff(at)uwm(dot)edu>, pgsql-general(at)postgresql(dot)org
Subject: Re: Re: Time Formats
Date: 2001-01-17 20:35:37
Message-ID: 01011715353708.02219@comptechnews
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Maybe try something like:

SELECT to_char(mytable.date + mytable.time, 'HH:MIAM');

That puts your separate date and time fields together into a timestamp, then
you can use to_char.

If you don't have a mytable.date, I think you could just do:

SELECT to_char(CURRENT_DATE + mytable.time, 'HH:MIAM');

In formatting the time part, I don't think it will look at the date part at
all. It might not matter what the date actually is in there.

On Wednesday 17 January 2001 12:20, Jeffery L Post wrote:
> Well I finaly got around to trying the to_char function. And I am having
> difficulty getting it to do what I want elegantly.
>
> Here is the situation...
> I am tracking the time that an event occurs in a column of type time.
> (seperate column for date). I want to display the time of the event in a
> fool proof HH:MM (AM | PM) format. As far as I can tell the to_char()
> function is not overloaded for the time type just timestamp.
>
> How do I format a column of type time to HH:MM AM | PM ?
> I belive the now() function returns a timestamp. but I need a strict time
> datatype example.
>
> Thanks again
> Jeff Post
> University of Wisconsin - Milwaukee

--
-------- Robert B. Easter reaster(at)comptechnews(dot)com ---------
-- CompTechNews Message Board http://www.comptechnews.com/ --
-- CompTechServ Tech Services http://www.comptechserv.com/ --
---------- http://www.comptechnews.com/~reaster/ ------------

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Travis Bauer 2001-01-17 20:43:18 plperl and sqrt.
Previous Message Patrick Welche 2001-01-17 20:28:17 Re: Re: MySQL file system