Re: Converting a timestamp to a time

From: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Converting a timestamp to a time
Date: 2006-11-05 10:17:24
Message-ID: 20061105101724.GA8761@KanotixBox
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Mark Morgan Lloyd <markMLl(dot)pgsql-general(at)telemetry(dot)co(dot)uk> schrieb:
> What is the correct (or even any :-) way of converting a timestamp into a time
> (without timezone etc.)?

You can CAST it:

test=# select now();
now
-------------------------------
2006-11-05 11:16:05.205235+01
(1 row)

test=# select now()::time;
now
----------------
11:16:18.22527
(1 row)

Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknow)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Kretschmer 2006-11-05 10:50:40 Re: help with a query
Previous Message Martijn van Oosterhout 2006-11-05 10:12:36 Re: Simple stored procedure examples?