start date of week based on week number

admin

Administrator
Staff member
Hi gurus
I have to find the start date of a week (first monday) based on a week number and the year...BUT... it is for an acedemic calendar. SO the first month of the year is august not january!

any ideas?That's such a specialized use of a calendar, I'd suggest just writing your own code.

Is this in ClASP (Classic ASP) or .NET?

You just need the monday returned, correct? Something like I need to know the date of the 12th monday of the term?

If that's the case something like this should work....



function findDay(dteStart,intWeeks)
findDay = dateAdd("w",intWeeks,dteStart)
end function


That function is super-simple and prolly a bit of overkill if that's all you need to do but I'm guessing you may want to add some logic for like Spring breaks and that sorta stuff.

The function also assumes that the dteStart is the same day as the one you want (monday to monday, etc.) If that's not always the case, you could add another parameter and combine in the use of the weekmod function to do a quick calculation for that.Its more like datePart
that he is looking for it sounds like..

he wants to know what the first day of the month falls on

DatePart("y",YourDate)

is what your looking for from what I read. If you want to move the Start of the year to Aug then you need to do some math on the Week Part for yourself, First real week is 1, your moving it to 40's, you need to subtract the value of the week you got from 40's

Like if its Nov then you need to find the week like above then using your Set Date as the povit and move the Week around based on some your known week + OffSet.
 
Back
Top