Re: Splitting Timestamps - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: Splitting Timestamps
Date
Msg-id 20060725170352.GB19297@surnet.cl
Whole thread Raw
In response to Splitting Timestamps  ("Chris Hoover" <revoohc@gmail.com>)
Responses Joining dates/times (was Re: Splitting Timestamps)  (Ron Johnson <ron.l.johnson@cox.net>)
List pgsql-general
Chris Hoover wrote:
> I have several columns in my database that are timestamps.  My developers
> are asking me how to split the timestamp so that they can look at either the
> date or at the time portion.
>
> I know I can do a select to_date(now(),'yyyy-mm-dd') and it will return the
> date.  However, how do I get the time?  Also, is this the proper way to get
> the date portion of a timestamp?

select now()::timetz;
select now()::time;
select now()::date;

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

pgsql-general by date:

Previous
From: "Chris Hoover"
Date:
Subject: Splitting Timestamps
Next
From: "A. Kretschmer"
Date:
Subject: Re: Splitting Timestamps