Elapsed time between timestamp variables in Function

From: "Nico Callewaert" <callewaert(dot)nico(at)telenet(dot)be>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Elapsed time between timestamp variables in Function
Date: 2009-02-04 09:51:15
Message-ID: FED34F5333CA4F0C951625BFBA5F476A@etsinformatics.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi !

I saw previous postings about elapsed time between 2 timestamps, using SELECT EXTRACT...
I have similar question, but it's not in a select statement, but between 2 variables in a function.

To keep it simple, I have 2 variables, let's say A and B, both TimeStamp. Now I would like to know the absolute value of elapsed seconds between the 2 timestamps. Has to be absolute value, because can be positive or negative, depends if A > B or A < B.
I tried with age(A, B), but that gives me something like 00:00:01, not really numeric value for number of seconds.

Many thanks in advance !
Nico

Browse pgsql-novice by date

  From Date Subject
Next Message Nagle, Gail A (US SSA) 2009-02-05 00:35:48 Starting postgres server automatically on Windows (XP)
Previous Message Nikhil teltia 2009-02-03 21:50:43 How to pass Array of Integer to UDF