Re: Subtraction of Dates

From: Steve Brett <SBrett(at)e-mis(dot)com>
To: Valerie Goodman <VGoodman(at)aih(dot)co(dot)uk>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Subtraction of Dates
Date: 2002-06-28 13:52:48
Message-ID: C05E7DA1218ED411BF8A00105AC95A8E0599DF86@sv-cntrmail.emis.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

try date_mi as opposed to direct subtraction.

eg:

edb=# select version();
version
---------------------------------------------------------------
PostgreSQL 7.0.3 on i686-pc-linux-gnu, compiled by gcc 2.95.2
(1 row)

edb=# select date_mi('2002-06-24','2002-06-21');
date_mi
---------
3
(1 row)

Steve

> -----Original Message-----
> From: Valerie Goodman [mailto:VGoodman(at)aih(dot)co(dot)uk]
> Sent: 27 June 2002 14:22
> To: pgsql-sql(at)postgresql(dot)org
> Subject: [SQL] Subtraction of Dates
>
>
>
> When I want an integer for a number of days between two dates, direct
> subtraction of two dates returns an integer.
>
> However, age function returns an interval.
>
> Which is the correct method to use and if age is the correct
> method, how do
> I convert that to the number of days?
>
>
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>
>

Browse pgsql-sql by date

  From Date Subject
Next Message Masaru Sugawara 2002-06-28 14:10:27 Re: Calculating with sql
Previous Message Steve Brett 2002-06-28 13:38:11 Re: Function question