Re: Plpgsql function to compute "every other Friday"

Поиск
Список
Период
Сортировка
От C. Bensend
Тема Re: Plpgsql function to compute "every other Friday"
Дата
Msg-id 4770a9359cf3f78d95c6cb4bddae269f.squirrel@webmail.stinkweasel.net
обсуждение исходный текст
Ответ на Re: Plpgsql function to compute "every other Friday"  ("David Johnston" <polobo@yahoo.com>)
Список pgsql-general
> It is a very simplistic approach since you do not take into account
> holidays.  But if it meets your needs what you want is the modulo operator
> (
> "%"; "mod(x,y)" is the equivalent function ) which performs division but
> returns only the remainder.
>
> N % 14 = [a number between 0 and (14 - 1)]
>
> N = 7; 7 % 14 = 7 (0, 7 remainder)
> N = 14; 14 % 14 = 0 (1, 0 remainder)
> N = 28; 28 % 14 = 0  (2, 0 remainder)
> N = 31; 31 % 14 = 3 (2, 3 remainder)

Ah, thank you, David.  This gives me some good knowledge that I
was missing!  I know about %, but I was fumbling a bit with it in
plpgsql, and your examples helped.

Thanks!

Benny


--
"Hairy ape nads."        -- Colleen, playing Neverwinter Nights



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

Предыдущее
От: John R Pierce
Дата:
Сообщение: Re: Plpgsql function to compute "every other Friday"
Следующее
От: "C. Bensend"
Дата:
Сообщение: Re: Plpgsql function to compute "every other Friday"