Re: Splitting Timestamps - Mailing list pgsql-general

From A. Kretschmer
Subject Re: Splitting Timestamps
Date
Msg-id 20060725171036.GA3890@webserv.wug-glas.de
Whole thread Raw
In response to Splitting Timestamps  ("Chris Hoover" <revoohc@gmail.com>)
List pgsql-general
am  25.07.2006, um 12:54:35 -0400 mailte Chris Hoover folgendes:
> 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.

The CAST-Operater is your friend:

est=# select now();
              now
-------------------------------
 2006-07-25 19:12:36.744262+02
(1 row)

test=# select now()::time;
       now
-----------------
 19:12:41.803128
(1 row)

test=# select now()::date;
    now
------------
 2006-07-25
(1 row)

test=#


HTH, Andreas
--
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47215,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===    Schollglas Unternehmensgruppe    ===

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Splitting Timestamps
Next
From: Curtis Scheer
Date:
Subject: Re: Splitting Timestamps