Re: TIMESTAMP difference

From: Rodrigo De León <rdeleonp(at)gmail(dot)com>
To: rihad <rihad(at)mail(dot)ru>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: TIMESTAMP difference
Date: 2007-12-10 20:07:56
Message-ID: a55915760712101207j2313d170h3e75437a62d5e310@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Dec 10, 2007 2:13 PM, rihad <rihad(at)mail(dot)ru> wrote:
> Hi, is there a way to get the difference in hours between two
> timestamps?

SELECT (EXTRACT (EPOCH FROM TIMESTAMP '20071211 00:00') - EXTRACT
(EPOCH FROM TIMESTAMP '20071209 01:00')) * INTERVAL '1 second';

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris Browne 2007-12-10 20:19:55 Re: slony question
Previous Message Nathan Wilhelmi 2007-12-10 20:00:44 Script to reset all sequence values in the a given DB?