Re: Date math
От | Guy Flaherty |
---|---|
Тема | Re: Date math |
Дата | |
Msg-id | 23d251df0906272321q4f9bd335i81839c51f42c4868@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Date math (Joe Conway <mail@joeconway.com>) |
Список | pgsql-general |
On Sun, Jun 28, 2009 at 2:52 PM, Joe Conway <mail@joeconway.com> wrote:
If all you want to do is check to see if someone's birthday is coming up within a set period, then this query will return true or false:
SELECT extract(doy FROM TIMESTAMP '1970-07-20') Adam Rich wrote:Hello,
I have a table with a DATE field "birth_date". The data obviously contains various dates in the past, such as 07/04/1970. In my query, I need to retrieve the person's "next" birthday. In other words, for the example date 07/04/1970, the query should return 07/04/2009 for the current week, but after this July 4th, it would return 07/04/2010. Ultimately, I need to find people with "next" birthdays within a certain range.
If all you want to do is check to see if someone's birthday is coming up within a set period, then this query will return true or false:
BETWEEN
extract(doy FROM now()) AND
extract( doy FROM CURRENT_DATE +30)
Guy Flaherty
[]
[]
В списке pgsql-general по дате отправления: