I'm trying to come up with an algorithm to calculate the number of week days (i.e. Monday through Fridays) between today and a date in the past. Because I eventually plan to translate this to P-SQL, I need to keep it very simple. Any ideas?

Getting the number of days difference and the current day of the week is easy. But I'm stuck on how to eliminate Saturdays and Sundays from the day count using math only.

Any help would be greatly appreciated.