Re: Extracting time from timestamp

From: "Shridhar Daithankar<shridhar_daithankar(at)persistent(dot)co(dot)in>" <shridhar_daithankar(at)persistent(dot)co(dot)in>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Extracting time from timestamp
Date: 2003-03-21 05:57:53
Message-ID: 200303211127.53101.shridhar_daithankar@persistent.co.in
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Thursday 20 Mar 2003 9:36 pm, Shridhar
Daithankar<shridhar_daithankar(at)persistent(dot)co(dot)in> wrote:
> I know this is rather stupid but still,
>
> I have a table which has a timestamp field in it and I need to get only
> time part of it. i.e. HH:MI format.

After much of RTFm( \df in psql in fact ), I found the solution. It is
timetz(abstime(timestamp)).

Well, timezone is OK with me but if somebody needs no timezones, then it is
still screwed though..

Further more, \df I find following output

time without time zone | pg_catalog | time| abstime
time without time zone | pg_catalog | time| interval
time without time zone | pg_catalog | time| text
time without time zone | pg_catalog | time| time with time zone
time without time zone | pg_catalog | time| time without time zone,
integer
time without time zone | pg_catalog | time| timestamp with time zone
time without time zone | pg_catalog | time| timestamp without time zone

I don't found these functions working as they expected. e.g.

phd=# select time(abstime(timestamp 'now')) from bookings;
ERROR: parser: parse error at or near "abstime" at character 13
phd=# select time(timestamp 'now') from bookings;
ERROR: parser: parse error at or near "timestamp" at character 13
phd=# select version();
version
---------------------------------------------------------------------
PostgreSQL 7.3.2 on i386-portbld-freebsd4.7, compiled by GCC 2.95.4
(1 row)

That goes for any timestamp value I presume. Is this a bug or am I
misinterpreting the information?

Shridhar

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christopher Kings-Lynne 2003-03-21 06:08:27 Re: [HACKERS] Extracting time from timestamp
Previous Message Tom Lane 2003-03-21 05:17:50 Re: fieldwidths

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-03-21 05:59:57 Re: probs with postgres
Previous Message Christopher Kings-Lynne 2003-03-21 05:50:56 Re: probs with postgres