Is there a way to identify the number of weekdays since the beginning of
the year that's somewhat easier (and, hopefully, more accurate) than I'm
coming up with?
What I've got so far is:
-- Gives the day's number in the year.
select to_char(sysdate,'DDD') from dual
-- The hack at the # of weekends in the year so far
-- Multiply the number of weeks * 2 on the theory that
-- each week has a weekend, ergo...
select to_char(sysdate,'WW') * 2 from dual;
--Combining the two:
select (to_char(sysdate,'DDD') - (to_char(sysdate,'WW') * 2)) from dual;
That sql results in 49 (as of Saturday, 3/11/00). However, according to
my calendar, there's been 50 weekdays since the beginning of the year.
If all else fails, I'll add a fudge factor; however, I'd like a cleaner
method of figuring that out...
This bit of ugliness is going to be part of a script that identifies
contractors' (particularly mine!) billing percentages. I'd like it to be
Thanks for any tips/suggestions.
PS: In case anyone's concerned, I get billed out as a UNIX admin, not an
Douglas K. O'Leary
Senior System Admin