| От | 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 по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера