<%@ Language=VBScript %> <% Option Explicit Const TOP_COORDINATE = 30 Dim curDate Dim daysCount Dim lastDay Dim firstDay Dim i Dim topC Dim leftC Dim tempDate Dim curMonth Dim curYear Dim calHTML Dim pDate Dim curMonthText Dim rowCount Dim nextMonth Dim prevMonth Dim retControl curDate = Request("date") retControl = Request("ctl") If IsDate(curDate) Then pDate = FormatDateTime(curDate, 0) If curDate = "" Then curDate = Now() Else If IsDate(curDate) Then curDate = Month(curDate) & "/" & Day(curDate) & "/" & Year(curDate) End If If IsDate(curDate) Then curMonth = Month(curDate) curMonthText = TextMonth(curMonth) & "-" & Year(curDate) curYear = Year(curDate) firstDay = curMonth & "/" & "01" & "/" & curYear lastDay = DateAdd("d", -1, DateAdd("m", 1, firstDay)) nextMonth = DateAdd("m", 1, firstDay) nextMonth = FormatDateTime(Month(nextMonth) & "/" & Day(curDate) & "/" & Year(nextMonth), 0) & _ "&ctl=" & retControl prevMonth = DateAdd("m", -1, firstDay) prevMonth = FormatDateTime(Month(prevMonth) & "/" & Day(curDate) & "/" & Year(prevMonth), 0) & _ "&ctl=" & retControl daysCount = CInt(Day(lastDay)) For i = 1 To daysCount tempDate = curMonth & "/" & i & "/" & curYear leftC = calcLeft(DatePart("w", tempDate, vbMonday)) topC = calcTop(tempDate) calHTML = calHTML & _ "
" & Day(tempDate) & "
" & vbCrLf Next End If Function fNumber(fNum) If Len(CStr(fNum)) < 2 Then fNumber = "0" & CStr(fNum) Else fNumber = fNum End If End Function Function calcLeft(wDay) calcLeft = ((wDay - 1) * 50) + 2 End Function Function calcTop(wDate) Dim mStartDate Dim mStartWeekDay Dim dRow mStartDate = Month(wDate) & "/" & "01/" & Year(wDate) mStartWeekDay = DatePart("w", mStartDate, vbMonday) dRow = ((mStartWeekDay + CInt(DateDiff("d", mStartDate, wDate))) 7) + 1 If Weekday(wDate, vbMonday) = 7 Then dRow = dRow - 1 calcTop = ((dRow - 1) * 20) + 1 + TOP_COORDINATE If dRow > rowCount Then rowCount = dRow End Function Function TextMonth(dMonth) Select Case dMonth Case 1: TextMonth = "January" Case 2: TextMonth = "February" Case 3: TextMonth = "March" Case 4: TextMonth = "April" Case 5: TextMonth = "May" Case 6: TextMonth = "June" Case 7: TextMonth = "July" Case 8: TextMonth = "August" Case 9: TextMonth = "September" Case 10: TextMonth = "October" Case 11: TextMonth = "November" Case 12: TextMonth = "December" End Select End Function %> Date picker
mon tue wed thu fri sat sun
<%=calHTML%>
Previous <%=curMonthText%> Next