Re: How Many Years have Passed?

Поиск
Список
Период
Сортировка
От Thomas Lockhart
Тема Re: How Many Years have Passed?
Дата
Msg-id 3C229188.EF5C9937@fourpalms.org
обсуждение исходный текст
Ответ на Re: How Many Years have Passed?  ("Greg Sabino Mullane" <greg@turnstep.com>)
Список pgsql-general
> > I have checked the FAQ and other sources and learned that the difference
> > between two dates is the integer number of days.  I want to know how many
> > years are between those two dates.

thomas=# select age(date 'today', date '1980-01-01'),
thomas-# extract(year from age(date 'today', date '1980-01-01'));
           age            | date_part
--------------------------+-----------
 21 years 11 mons 20 days |        21

Is this close to what you want? The nice thing about the age() function
is that it preserves the qualitative units of month and year.

                      - Thomas

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

Предыдущее
От: "Greg Sabino Mullane"
Дата:
Сообщение: Re: How Many Years have Passed?
Следующее
От: Gurudutt
Дата:
Сообщение: Re: