Todays The Daily WTF titled "Got Time?" reminded me of one of those horrible hacks I had to deal with when I was there.
We used to have one of those business rules. "X business days from now". Where weekends, and national public holidays, were not considered "business days". Because this business rule was observed in the Oracle Forms interface that was used by our operations staff, a way to take now() + N business days was needed.
# select * from days_of_week order by num;
In this entirely ficticious example from my memory of this table, that's what the data looked like. All saturdays and sundays and public holidays were listed in the table with a blank 'num'. To find a date 10 business days from now, you would do:
select day_of_week from days_of_week where num = (select num from days_of_week where day_of_week = today()) + 10.
Every so often we would "run out of days" and an email would be sent. Then a script would be written to add another batch of days to the table, then we'd be good until we run out again...
I've been at my current employer for over 5 years now, and am extremely happy I left tripe like what I've just dredged out of my memory behind.