Re: Re: Time Formats
От | Robert B. Easter |
---|---|
Тема | Re: Re: Time Formats |
Дата | |
Msg-id | 01011715353708.02219@comptechnews обсуждение исходный текст |
Ответ на | Re: Time Formats (Jeffery L Post <postjeff@uwm.edu>) |
Список | 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@comptechnews.com --------- -- CompTechNews Message Board http://www.comptechnews.com/ -- -- CompTechServ Tech Services http://www.comptechserv.com/ -- ---------- http://www.comptechnews.com/~reaster/ ------------
В списке pgsql-general по дате отправления: