Re: Splitting Timestamps

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Splitting Timestamps
Date: 2006-07-25 17:10:36
Message-ID: 20060725171036.GA3890@webserv.wug-glas.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 ===

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Curtis Scheer 2006-07-25 17:12:42 Re: Splitting Timestamps
Previous Message Alvaro Herrera 2006-07-25 17:03:53 Re: Splitting Timestamps