PDA

View Full Version : determining mondays in date range


havey
08-29-2006, 06:36 PM
Hi i have a date range like 15-09-2006 to 17-10-2006
and i trying to figure our how many Mondays are in that date range and what are their dates?

I found that
rStartDate = WeekdayName(Weekday(objRS("RateStartDate")))
rEndDate = WeekdayName(Weekday(objRS("RateEndDate")))
gives me the actually name of the days in a week, bu how would i iterate through finding the date to which every monday resides on?

Thanks!

Wylie
08-29-2006, 07:54 PM
You have not to use WeekdayName for counting how many Mondays in a specify date range because Weekday is good enough.

Weekday(objRS("RateStartDate")) should returned a number to you such as 1 for Sunday, 2 for Monday, 3 for Tuesday, etc...

havey
08-29-2006, 08:31 PM
Thanks Wylie,

one more question about determining date ranges, if you would not mind,
how would one determine which days if any the Discount rate range is in the RateStartDate to RateEndDate range. Dates are in format 2006-09-01

strDiscountStart
strDiscountEnd

RateStartDate
RateEndDate

Wylie
08-29-2006, 09:29 PM
You can use DateDiff() to calculate how many day Discount rate range has. So that DateAdd() can add more than a day to skip that Discount rate range.

PS. format is not a problem because those object are Date.

havey
08-30-2006, 08:00 PM
cheers! very helpful.