Re: Splitting Timestamps

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Chris Hoover <revoohc(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Splitting Timestamps
Date: 2006-07-25 17:03:53
Message-ID: 20060725170352.GB19297@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message A. Kretschmer 2006-07-25 17:10:36 Re: Splitting Timestamps
Previous Message Chris Hoover 2006-07-25 16:54:35 Splitting Timestamps