>Hi there. I tried to find the "Stupid Questions" category for this one, but it didn't exist. :) Is there a way to count the number of business days (which would be everyday but Sat. and Sun.) that have occurred from Jan. 1st to today? just wondering....tia.
My .2 cents Erin.
Do not depent on cdow() unless you always use localized versions. OTOH string operations would slow down calculation. There is already dow() instead. Instead of calculating with a loop you could directly query week() and multiply by workdays - IMHO faster.
lnFullWeeks = max(week(date(),1,2),0)
lnFirstWeekDays = max(8-dow(date(year(date()),1,1),2) - 2,0)
lnThisWeekDays = iif(week(date(),1,2)=1,0,min(dow(date(),2),5))
lnWorkDays = lnFullWeeks * 5 + lnFirstWeekDays + lnThisWeekDays
This calculates workdays excluding holidays.
Cetin