From: | "Richard Huxton" <dev(at)archonet(dot)com> |
---|---|
To: | "Jeff Rhys-Jones" <jeff(at)emojo(dot)com>, <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Using DateDiff with Postgres |
Date: | 2001-06-28 14:44:38 |
Message-ID: | 003501c0ffe0$dc3e4700$1001a8c0@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
From: "Jeff Rhys-Jones" <jeff(at)emojo(dot)com>
> Hi there. I was wondering if anyone can tell me the correct syntax for
> using DateDiff for postgrees. I'm using MI (or mi) for minute and I
> keep getting attribute 'mi' not found.
>
> I've looked at postgres.org and can't seem to find any ref. to using
> datediff.
You just subtract dates with PG:
select now() - CURRENT_DATE;
Will return an "interval" type with the elapsed time since midnight. If you
want that in seconds do:
select extract(epoch from (now() - CURRENT_DATE));
Converting to minutes is obviously easy from there.
I think datediff() is a MS-Access thing isn't it?
- Richard Huxton
From | Date | Subject | |
---|---|---|---|
Next Message | Christof Glaser | 2001-06-28 14:45:17 | Re: Link many attributes in one table to one attribute in another?? |
Previous Message | Ilan Fait | 2001-06-28 14:34:03 | examine the database |