<% session.lcid = 1053 '-- declare variables -- Dim dDate Dim sDate Dim startDay Dim endDay '-- recevie date -- sDate = request.querystring("dDate") if len(sDate) = 0 then dDate = now() else dDate = CDate(sDate) end if %>
<% '-- find start day and endDay -- startDay = getStartDay(Year(dDate),month(dDate)) endDay = getEndDay(CDate(Year(dDate) &"-" & month(dDate) & "-01")) iDay = startDay do until DateDiff("d",iDay,endDay) = 0 if weekday(iDay) = 2 then response.write "" response.write " " end if Call writeDay(iDay, month(dDate)) if weekday(iDay) = 1 then 'response.write " " response.write "" end if iDay = DateAdd("d",1,iDay) loop %>
<%= MonthName(Month(dDate)) %> <%=Year(dDate) %>
  M T O T F L S
 
"& Right("0" & DatePart("ww",iDay,2,2),2) &" 
 
<% '------------------------------------------------------------------------- '-- FUNCTIONS -- '------------------------------------------------------------------------- function writeDay(thisDay, tempMonth) '-- declare variables ------------------------------------------ Dim sclass '-- get correct styleclass -- if weekday(thisDay) > 1 AND weekday(thisDay) < 7 then sClass = "weekDay" elseif weekday(thisDay) = 7 then sClass = "weekEnd" elseif weekday(thisDay) = 1 then sClass = "freeDay" end if if month(thisDay) <> tempMonth then sClass = sClass & "_NotActiveMonth" else sClass = sClass & "_ActiveMonth" end if if DateDiff("d", thisDay, now()) = 0 then sClass = sClass & "_today" end if '-- write out day ------------------------------------------ if month(thisDay) <> tempMonth then response.write " " response.write Day(thisDay) response.write " " else response.write " " response.write Day(thisDay) response.write " " end if end function '------------------------------------------------------------------------- '------------------------------------------------------------------------- '-- getStartDay() -- '------------------------------------------------------------------------- function getStartDay(tYear, tMonth) '-- declare variables ------------------------------------------ Dim tStartDay '-- END: declare variables ---------------------------------- '-- get this months first days date -------------------------- tStartDay = CDate(tYear &"-" & tMonth & "-01") '-- END: get this months first days date ------------------ '-- get the first day for the first week in this month ---------- select case Cint(WeekDay(tStartDay)) case 2 tStartDay = DateAdd("d",0,tStartDay) case 3 tStartDay = DateAdd("d",-1,tStartDay) case 4 tStartDay = DateAdd("d",-2,tStartDay) case 5 tStartDay = DateAdd("d",-3,tStartDay) case 6 tStartDay = DateAdd("d",-4,tStartDay) case 7 tStartDay = DateAdd("d",-5,tStartDay) case 1 tStartDay = DateAdd("d",-6,tStartDay) end select '-- END: get the first day for the first week in this month -- '-- uninit -------------------------------------------------- getStartDay = tStartDay '-- END: uninit -------------------------------------------------- end function '------------------------------------------------------------------------- '------------------------------------------------------------------------- '-- getStartDay() -- '------------------------------------------------------------------------- function getEndDay(tStartDay) '-- declare variables ------------------------------------------ Dim tEndDay '-- END: declare variables ---------------------------------- '-- get this months first days date -------------------------- tEndDay = DateAdd("m",1,tStartDay) '-- END: get this months first days date ------------------ '-- get the first day for the first week in this month ---------- select case Cint(WeekDay(tEndDay)) case 2 tEndDay = tEndDay ' DateAdd("d",7,tEndDay) case 3 tEndDay = DateAdd("d",6,tEndDay) case 4 tEndDay = DateAdd("d",5,tEndDay) case 5 tEndDay = DateAdd("d",4,tEndDay) case 6 tEndDay = DateAdd("d",3,tEndDay) case 7 tEndDay = DateAdd("d",2,tEndDay) case 1 tEndDay = DateAdd("d",1,tEndDay) end select '-- END: get the first day for the first week in this month -- '-- uninit -------------------------------------------------- getEndDay = tEndDay '-- END: uninit -------------------------------------------------- end function '------------------------------------------------------------------------- %>