Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date based on week number

Status
Not open for further replies.

guitardave78

Programmer
Sep 5, 2001
1,294
GB
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?
 
Have you tried using ww for the DateAdd function?
Should be something like:
Code:
<%
Dim stDate
stDate = DateSerial(2005,8,1)

'move start date to the next occurence of Monday
stDate = DateAdd("d",(9-WeekDay(stDate)) mod 7,stDate)

'output the dates for the next 5 weeks using DateAdd and "ww" interval
Dim i, enDate
For i = 0 to 5
	enDate = DateAdd("ww",i,stDate)
	Response.Write FormatDateTime(enDate,1) & "<br/>"
Next
%>

Try it out, can't always try my no-the-fly code :)

-T


barcode_1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top