RE: Comparing dates in 3.0

Поиск
Список
Период
Сортировка
От Francis Solomon
Тема RE: Comparing dates in 3.0
Дата
Msg-id NEBBIFFPELJMCJAODNPKOECKCDAA.francis@stellison.co.uk
обсуждение исходный текст
Ответ на Comparing dates in 3.0  (Ellen Spertus <spertus@mills.edu>)
Список 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@postgresql.org
> [mailto:pgsql-general-owner@postgresql.org]On Behalf Of Ellen Spertus
> Sent: 17 November 2000 04:39
> To: pgsql-general@postgresql.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
>
>


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

Предыдущее
От: Robert Boyd
Дата:
Сообщение: Re: [NOVICE] Skipping numbers in a sequence.
Следующее
От: hubert depesz lubaczewski
Дата:
Сообщение: create snapshot?