Re: missing something obvious about intervals?

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Jim Buttafuoco <jim(at)contactbda(dot)com>
Cc: David Rysdam <drysdam(at)ll(dot)mit(dot)edu>, "pg >> Postgres General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: missing something obvious about intervals?
Date: 2005-12-12 18:34:45
Message-ID: 20051212183445.GA4492@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Mon, Dec 12, 2005 at 13:04:05 -0500,
Jim Buttafuoco <jim(at)contactbda(dot)com> wrote:
>
> try
>
>
> select '2005-12-01'::date + (456.5::float || ' seconds')::interval;
> ?column?
> ------------------------
> 2005-12-01 00:07:36.50
> (1 row)

You are better off doing a multiply. Something like:
area=> select '2005-12-01'::date + 456.5 * '1 second'::interval;
?column?
------------------------
2005-12-01 00:07:36.50
(1 row)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2005-12-12 18:41:36 Re: Free Pascal and Postgresql Functions, Possible?
Previous Message Volkan YAZICI 2005-12-12 18:24:09 Re: missing something obvious about intervals?

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Fuhr 2005-12-12 18:50:16 Re: How much expensive are row level statistics?
Previous Message Merlin Moncure 2005-12-12 18:33:27 Re: How much expensive are row level statistics?