Been a while since I had to do this... you need 'zeller congruence', an arithmetic formula to convert date to day-of-week (circa late 1800's IIRC). Google says 475 hits -- Rich
On Mon, 3 Dec 2001, C.E.O. wrote: > Date: Mon, 3 Dec 2001 13:25:18 -0600 > From: C.E.O. <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] > Subject: Need help with workweek to week dates ... > > My company uses a custom workweek that begins > at Midnight on Saturday and ends on Friday at 23:59:59.99. > > I need a subroutine that can take as input a workweek (12, 26, 36) > and take as input a year (2002, 2003, 2004) all in the same > operation. Then I need the subroutine to return values as > custom workweek dates, like ... > > For workweek 12 of 2002, the return values would be .. > > 16-MAR-2002, 17-MAR-2002, 18-MAR-2002, 19-MAR-2002, 20-MAR-2002, > 21-MAR-2002, 22-MAR-2002. > > For workweek 26 of 2003, the return values would be .. > > 21-JUN-2003, 22-JUN-2003, 23-JUN-2003, 24-JUN-2003, 25-JUN-2003, > 26-JUN-2003, 27-JUN-2003. > > For workweek 36 of 2004, the return values would be .. > > 28-AUG-2004, 29-AUG-2004, 30-AUG-2004, 31-AUG-2004, 1-SEP-2004, > 2-SEP-2004, 3-SEP-2004. > > I can take a yearday and get a workweek number like .. > > March 25th is the 85th day of the year, if there is no leap year that year. > > (85/7)+1 = 13.14285714 > > So I know it's in workweek 13. I can take 7*.14285714 and get approximately 1. > Assuming that Zero is Sunday, I can match up 1 with Monday and so on. > > My problem is that the custom workweek starts on Saturdays. > > Any help/code examples are really appreciated, > > ~ > > > > > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]