TIMESTAMP SUBTRACTION - Mailing list pgsql-general

Hi All,
     When I subtract 2 timestamp variables in postgres 2.3.1, I get an
interval value.
Eg:
SELECT TO_TIMESTAMP('05-21-2003 00:00:00','mm-dd-yyyy') -
TO_TIMESTAMP('04-30-2003 00:00:00','mm-dd-yyyy');
Result:
    21 days --------- This is an interval

But what I need is a numeric value. Ie; 21 and NOT 21 days.

I need to compare this difference with a numeric value in my WHERE clause
like this

WHERE
    TIMESTAMP('05-21-2003 00:00:00','mm-dd-yyyy') - TO_TIMESTAMP('04-30-2003
00:00:00','mm-dd-yyyy') > 30

But if I do this....I get wrong results. How do I do such a comparison? Or
How to I get a Numeric value after the subtraction?


Please reply SOON !!!

Thanx,
Madhavi Daroor




pgsql-general by date:

Previous
From: John Schickling
Date:
Subject: psql and ssl.
Next
From: "Shridhar Daithankar"
Date:
Subject: Re: TIMESTAMP SUBTRACTION