Skip site navigation (1) Skip section navigation (2)

Re: subtract two dates to get the number of days

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: subtract two dates to get the number of days
Date: 2010-07-13 15:05:12
Message-ID: i1hvb8$58a$1@dough.gmane.org (view raw or flat)
Thread:
Lists: pgsql-sql
Campbell, Lance, 13.07.2010 16:58:
> I want to subtract to dates to know the number of days different.
>
> Example:
>
> 01/02/2010 - 01/01/2010 = 1 day
>
> 08/01/2010 - 07/31/2010 = 1 day
>
> How do I do this?

SELECT DATE '2010-02-01' - DATE '2010-01-01';

SELECT DATE '2010-08-01' - DATE '2010-07-31';






In response to

pgsql-sql by date

Next:From: silly sadDate: 2010-07-14 05:28:35
Subject: Re: subtract two dates to get the number of days
Previous:From: Tom LaneDate: 2010-07-13 15:02:10
Subject: Re: subtract two dates to get the number of days

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group