<%@LANGUAGE="VBSCRIPT"%> <% curpath = "http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("URL") curpath = Left(curpath, InstrRev(curpath, "/")) %> <% Dim rsCal Dim rsCal_numRows Set rsCal = Server.CreateObject("ADODB.Recordset") rsCal.ActiveConnection = MM_blog_STRING rsCal.Source = "SELECT * FROM tblBlog WHERE Month(BlogDate) = Month(Now()) ORDER BY BlogDate ASC" rsCal.CursorType = 0 rsCal.CursorLocation = 2 rsCal.LockType = 1 rsCal.Open() rsCal_numRows = 0 %> <% Dim Repeat1__numRows Dim Repeat1__index Repeat1__numRows = -1 Repeat1__index = 0 rsCal_numRows = rsCal_numRows + Repeat1__numRows %> <% Dim MyMonth 'Month of calendar Dim MyYear 'Year of calendar Dim FirstDay 'First day of the month. 0 = Sunday Dim CurrentDay 'Used to print dates in calendar Dim Col 'Calendar column Dim Row 'Calendar row MyMonth = cint(Request("chosenYear")) MyYear = cint(Request("chosenMonth")) If MyMonth = 0 then MyMonth = Month(Date) if MyYear = 0 then MyYear = Year(Date) %>
<% FirstDay = WeekDay(DateSerial(MyYear, MyMonth, 1)) -1 CurrentDay = 1 'Let's build the calendar For Row = 0 to 5 For Col = 0 to 6 If Row = 0 and Col < FirstDay then response.write "" elseif CurrentDay > LastDay(MyMonth, MyYear) then response.write "" else response.write "" else response.write " align=middle>" end if if rsCal.EOF then flgEnd = 1 end if if flgEnd <> 1 then theCurrentDay = Day(rsCal.Fields.Item("BlogDate").Value) end if Do Until Day(rsCal.Fields.Item("BlogDate").Value) <> CurrentDay if CurrentDay = theCurrentDay then Response.Write("" & CurrentDay & "") else response.write "" & CurrentDay & "" end if CurrentDay = CurrentDay + 1 End If Next response.write "" Next Function MonthName(MyMonth) Select Case MyMonth Case 1 MonthName = "January" Case 2 MonthName = "Febuary" Case 3 MonthName = "March" Case 4 MonthName = "April" Case 5 MonthName = "May" Case 6 MonthName = "June" Case 7 MonthName = "July" Case 8 MonthName = "August" Case 9 MonthName = "September" Case 10 MonthName = "October" Case 11 MonthName = "November" Case 12 MonthName = "December" Case Else MonthName = "ERROR!" End Select End Function Function LastDay(MyMonth, MyYear) ' Returns the last day of the month. Takes into account leap years ' Usage: LastDay(Month, Year) ' Example: LastDay(12,2000) or LastDay(12) or Lastday Select Case MyMonth Case 1, 3, 5, 7, 8, 10, 12 LastDay = 31 Case 4, 6, 9, 11 LastDay = 30 Case 2 If IsDate(MyYear & "-" & MyMonth & "-" & "29") Then LastDay = 29 Else LastDay = 28 Case Else LastDay = 0 End Select End Function %> <% rsCal.Close() Set rsCal = Nothing %>
<%=MonthName(MyMonth)%>
Sun Mon Tue Wed Thu Fri Sat