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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Shane R(dot) Spencer" <shane(at)bogomip(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: More straight forward method to convert seconds::bigint to interval
Date: 2009-09-23 20:41:24
Message-ID: 7350.1253738484@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Shane R. Spencer" <shane(at)bogomip(dot)com> writes:
> Is there a less string oriented method of converting seconds as an int
> to an interval?

Multiply by an interval, eg

123456.789 * interval '1 second'

It works, it's fast, and you can use any scale factor you want.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adam Rich 2009-09-23 20:48:43 Re: More straight forward method to convert seconds::bigint to interval
Previous Message Shane R. Spencer 2009-09-23 20:31:39 More straight forward method to convert seconds::bigint to interval