From: | Steve Crawford <scrawford(at)pinpointresearch(dot)com> |
---|---|
To: | Joseph Shraibman <jks(at)selectacast(dot)net>, PostgreSQL General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: fomatting an interval (resend) |
Date: | 2003-05-13 16:08:35 |
Message-ID: | 20030513160835.C65B2103C2@polaris.pinpointresearch.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
How about:
select to_char(finish-start, 'HH24:MI:SS') from timetable;
to_char
----------
00:01:29
This won't work if the interval is > 24 hours - you would have to add
formatting to allow for days.
Cheers,
Steve
On Monday 12 May 2003 6:47 pm, Joseph Shraibman wrote:
> playpen=# select version();
> version
> ---------------------------------------------------------------------
> PostgreSQL 7.3.2 on i686-pc-linux-gnu, compiled by GCC egcs-2.91.66
> (1 row)
>
> playpen=# begin;
> BEGIN
> playpen=# create table timetable (start timestamp, finish timestamp);
> CREATE TABLE
> playpen=# insert into timetable values('2003-05-12 21:37:44.933',
> '2003-05-12 21:39:14.752'); INSERT 1648889 1
> playpen=# select start, finish, (finish-start),(finish-start)::interval(0)
> from timetable; start | finish | ?column? |
> interval
> -------------------------+-------------------------+--------------+--------
>------ 2003-05-12 21:37:44.933 | 2003-05-12 21:39:14.752 | 00:01:29.819 |
> 00:01:29.819 (1 row)
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2003-05-13 16:22:14 | OpenVMS Port? |
Previous Message | Bruno Wolff III | 2003-05-13 15:36:07 | Re: Creating functions and triggers |
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2003-05-13 16:16:44 | Re: GUC and postgresql.conf docs |
Previous Message | Peter Eisentraut | 2003-05-13 15:43:11 | Re: GUC and postgresql.conf docs |