| От | Josh Berkus |
|---|---|
| Тема | SQL Challenge: Skip Weekends |
| Дата | |
| Msg-id | 200206201713.03801.josh@agliodbs.com обсуждение исходный текст |
| Список | pgsql-sql |
Folks, Hey, I need to write a date calculation function that calculates the date after a number of *workdays* from a specific date. I pretty much have the "skip holidays" part nailed down, but I don't have a really good way to skip all weekends in the caluclation. Here's the ideas I've come up with: Idea #1: Use a reference table 1. Using a script, generate a table of all weekends from 2000 to 2050. 2. Increase the interval by the number of weekends that fall in the relevant period. Idea #2: Some sort of calculation using 5/7 of the interval, adjusted according to the day of the week of our starting date. My head hurts trying to figure this one out. -- -Josh Berkus
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера