Re: subtract two dates to get the number of days

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: subtract two dates to get the number of days
Дата
Msg-id 29026.1279033330@sss.pgh.pa.us
обсуждение исходный текст
Ответ на subtract two dates to get the number of days  ("Campbell, Lance" <lance@illinois.edu>)
Список pgsql-sql
"Campbell, Lance" <lance@illinois.edu> writes:
> 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? 

If they're dates, you just subtract.

regression=# select '08/01/2010'::date - '07/31/2010'::date;?column? 
----------       1
(1 row)

        regards, tom lane


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Campbell, Lance"
Дата:
Сообщение: subtract two dates to get the number of days
Следующее
От: Thomas Kellerer
Дата:
Сообщение: Re: subtract two dates to get the number of days