Re: extracting time from a timestamp with time zone field - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: extracting time from a timestamp with time zone field
Date
Msg-id 20030408232447.GB15928@svana.org
Whole thread Raw
In response to Re: extracting time from a timestamp with time zone field  (Peter Nixon <listuser@peternixon.net>)
List pgsql-general
On Tue, Apr 08, 2003 at 11:38:38AM +0300, Peter Nixon wrote:
> date_truc seems to only lower precision which is not what I want.
> For instance if the value in my TIMESTAMP field is:
> 2001-02-16 20:38:40
> I want a function that outputs:
> 20:38:40
> ie the time, WITHOUT the date part of the field.

Just cast it:
# select cast('2001-02-16 20:38:40'::timestamp as time);
 ?column?
----------
 20:38:40
(1 row)

--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> "the West won the world not by the superiority of its ideas or values or
> religion but rather by its superiority in applying organized violence.
> Westerners often forget this fact, non-Westerners never do."
>   - Samuel P. Huntington

Attachment

pgsql-general by date:

Previous
From: Joe Conway
Date:
Subject: Re: Covariance Function in Postgresql??
Next
From: Medi Montaseri
Date:
Subject: Re: Cross database reference (databases are on the same