If you have a correctly formed time dimension, then you will not need any weird code.
In the time dimension table you store weekday / weekend information and can easily select the requested days. DB operations are a lot more performant than code logic.
Please post some example about what information you have and what is the expected output using xls or OBIEE screens.
Trying to implement this logic in code is a nightmare. What about leap years for example? As Christian said above, the best solution and best practice is to have a date dimension in which you'd have a flag that indicates if a date is a weekday in your case.