Thread: Problem w/ date calculation.

Problem w/ date calculation.

From
Mike Diehl
Date:
Hi all,

I'm having a problem with a date calculation.  I'm trying to get a list of
all records who's "last_backed_up" field indicates one day or older.

But, I'm doing something wrong with age().

For example, if the current date is:
mapping=# select now();
             now
------------------------------
 2002-11-06 16:16:09.62247-07
(1 row)

Then the age of a field containing 2002-11-05 17:25:33.89754-07 should be
about 23 hours, right?

Well:
mapping=# select age(timestamp '2002-11-05 17:25:33.89754-07');
      age
----------------
 06:34:26.10246
(1 row)

What am I missing?

TIA.

--
Mike Diehl
Network Tools Devl.
SAIC at Sandia Labs
(505) 284-3137