Re: how to get number of minutes?

From: Casey Duncan <casey(at)pandora(dot)com>
To: Chris Hoover <revoohc(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: how to get number of minutes?
Date: 2006-10-06 20:16:55
Message-ID: F33B3788-25A7-4F03-81DD-4729F97D2A2C@pandora.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

select extract(epoch from interval '2 hours')/60;

'epoch' returns the number epoch seconds that comprise the interval.
That differs from 'seconds' which just returns the "seconds place",
which is zero for 2:00:00 of course.

-Casey

On Oct 6, 2006, at 12:22 PM, Chris Hoover wrote:

> If I subtract 2 timestamps, how do I get the results returned as
> the total number of minutes.
>
> example
>
> now() - (now()-'2 hours'::interval) = 2:00:00 -- I need the result
> returned as 120 minutes.
>
> Thanks,
>
> Chris

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-10-06 20:24:16 Re: Alter table alter column
Previous Message Marc Munro 2006-10-06 20:15:59 Alter table alter column