Try this:
Code:
<%
function getSundayOfWeek(weekNum, year)
dim dNewYear, dFirstSunday
dNewYear = "1/1/" & year 'm/d/yyyy
dFirstSunday = weekday(dNewYear)
if dFirstSunday = 1 then 'sunday already
dFirstSunday = dNewYear
else 'not sunday so get next sunday
dFirstSunday = "1/" & (2 + (7 - dFirstSunday)) & "/" & year 'm/d/yyyy
end if
getSundayOfWeek = dateadd("WW", weekNum-1, dFirstSunday) 'add weeks (subtract 1 to weeknum so that calculation is inclusive of the dFirstSunday
end function
response.write(getSundayOfWeek(52,2004)) '12/26/2004
response.write(getSundayOfWeek(31,2004)) '8/1/2004
%>
Take note that the function uses m/d/yyyy as the dateformat which is the settings in my Regional Options (Control Panel). Tweak the code to make it dd/mm/yyyy.