Skip site navigation (1) Skip section navigation (2)

Interval output format

From: "Stefan Waidele jun(dot)" <St(dot)Waidele(dot)jun(at)Krone-Neuenburg(dot)de>
To: pgsql-novice(at)postgresql(dot)org
Subject: Interval output format
Date: 2001-01-18 16:40:34
Message-ID: 5.0.2.1.0.20010118173956.00ac6c98@imap.Krone-Neuenburg.de (view raw or flat)
Thread:
Lists: pgsql-novice
How can I tell Postgres to return an interval value in an format like hhh:mm?

I want to write an application to sum up hours.
I can get the sum with something like

select sum(hours) from table

But the output is '2 10:15'. This is correct, meaning I have worked 58 
hours and 15 minutes.

The user needs something like '58:15', and my front end could convert that 
(Delphi-Application).
But then I want the reports to be done on the server, using Perl. Good, 
Perl can calculate
that. But I have to re implement the conversion, which ist error-prone.

Also it would be nice to have Postgres do the conversion, so that front 
ends like psql could
be used.

Thanks for Your help,

Stefan


Responses

pgsql-novice by date

Next:From: Rhys JonesDate: 2001-01-18 16:52:00
Subject: Novice lo_import problem (7.0.3)
Previous:From: zivitDate: 2001-01-18 16:28:14
Subject: ERROR: plpgsql: cache lookup from pg_proc failed -- Why?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group