pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Subtraction of Dates
2+ messages / 2 participants
[nested] [flat]

* Subtraction of Dates
@ 2002-06-27 13:21 Valerie Goodman <VGoodman@aih.co.uk>
  0 siblings, 0 replies; 2+ messages in thread

From: Valerie Goodman @ 2002-06-27 13:21 UTC (permalink / raw)
  To: pgsql-sql


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?







^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Subtraction of Dates
@ 2002-06-28 13:52 Steve Brett <SBrett@e-mis.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Steve Brett @ 2002-06-28 13:52 UTC (permalink / raw)
  To: Valerie Goodman <VGoodman@aih.co.uk>; 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@aih.co.uk]
> Sent: 27 June 2002 14:22
> To: pgsql-sql@postgresql.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
> 
> 





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2002-06-28 13:52 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-06-27 13:21 Subtraction of Dates Valerie Goodman <VGoodman@aih.co.uk>
2002-06-28 13:52 Re: Subtraction of Dates Steve Brett <SBrett@e-mis.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox