From: | "Francis Solomon" <francis(at)stellison(dot)co(dot)uk> |
---|---|
To: | "Ellen Spertus" <spertus(at)mills(dot)edu> |
Cc: | "Pgsql-General(at)Postgresql(dot) Org" <pgsql-general(at)postgresql(dot)org> |
Subject: | RE: Comparing dates in 3.0 |
Date: | 2000-11-24 11:10:52 |
Message-ID: | NEBBIFFPELJMCJAODNPKOECKCDAA.francis@stellison.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi Ellen,
Subtracting one timestamp from another returns an interval type, like
this:
stasis=# select 'now'::timestamp - '10 Sep 2000'::timestamp;
?column?
-------------
75 12:06:57
(1 row)
But if you just want the days only, try this:
stasis=# select date_part('days', 'now'::timestamp - '10 Sep
2000'::timestamp);
date_part
-----------
75
(1 row)
Hope this helps.
Regards
Francis
> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org
> [mailto:pgsql-general-owner(at)postgresql(dot)org]On Behalf Of Ellen Spertus
> Sent: 17 November 2000 04:39
> To: pgsql-general(at)postgresql(dot)org
> Subject: [GENERAL] Comparing dates in 3.0
>
>
> After upgrading from 6.x to 7.x, the following query broke, I
> lost the
> ability to check how many days apart two DATEs are by subtracting
> them. What is the correct way to determine the difference
> between two
> dates in 7.x?
>
> Thank you.
>
> Ellen Spertus
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Gabriel Fernandez | 2000-11-24 11:14:47 | Table whose name has Capital letters |
Previous Message | hubert depesz lubaczewski | 2000-11-24 11:09:45 | create snapshot? |