More straight forward method to convert seconds::bigint to interval

From: "Shane R(dot) Spencer" <shane(at)bogomip(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: More straight forward method to convert seconds::bigint to interval
Date: 2009-09-23 20:31:39
Message-ID: 4ABA85AB.5060704@bogomip.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I work in VoIP. HMS (Hour/Minute/Second) format appears to be the rule
when working with call time totals. I admit it makes some reports
easier to read.

The method I used to convert a int/bigint to HMS (or the standard
representation of an interval type) is as follows:

select (123456.789::varchar(24) || ' seconds')::interval as HMS;
hms
--------------
34:17:36.789

Is there a less string oriented method of converting seconds as an int
to an interval?

- Shane

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-09-23 20:41:24 Re: More straight forward method to convert seconds::bigint to interval
Previous Message JC Praud 2009-09-23 19:28:07 grants on pg_stats_activity