Hi all!
I think my brain just went on leave 'cause I can't figure this one out. It should be easy. I have this page rendering a month calendar. The weeks start with sunday. How do I chang the code so the weeks start with monday?
Best Regards MaB
--------------------------
----------
--------
CODE
--------------------------
----------
--------
<!--#include file="funktioner.asp"-->
<head>
</head>
<%
dim nDex, nMonth, nYear, dtDate
' Get the current date
dtDate = Now()
' Set the Month and Year
nMonth = Request.QueryString("nMont
h")
nYear = Request.QueryString("nYear
")
if nMonth = "" then nMonth = Month(dtDate)
if nYear = "" then nYear = Year(dtDate)
' Set the date to the first of the current month
dtDate = DateSerial(nYear, nMonth, 1)
DoHeader(MonthName(Month(d
tDate)) & " " & nYear)
%>
<form method="get" name="DateSelect" action="calTest.asp">
<table width=251>
<tr><td><select name="nMonth" onChange="DateSelect.submi
t();"><%
for nDex = 1 to 12
Response.Write "<option value=""" & nDex & """"
if MonthName(nDex) = MonthName(nMonth) then
Response.Write " selected"
end if
Response.Write ">" & MonthName(nDex)
next %></select>
<select name="nYear" onChange="DateSelect.submi
t();"><%
' Note: I have set the year to be between 2000 and 2008
for nDex = 2000 to 2008
Response.Write "<option value=""" & nDex & """"
if nDex = CInt(nYear) then Response.Write " selected"
Response.Write ">" & nDex
next %></select></td><td align="right">
<% Dim prevMonth, nextMonth
Select Case CInt(nMonth) :
Case 1
prevMonth = 12
nextMonth = CInt(nMonth) +1
Case 12
prevMonth = CInt(nMonth) -1
nextMonth = 1
Case Else
prevMonth = CInt(nMonth) -1
nextMonth = CInt(nMonth) +1
End Select
%>
<input type="button" value="<<" name="prevMonth" onclick="window.open('calT
est.asp?nM
onth=<%=pr
evMonth%>
<%
Dim prevYear
If prevMonth=12 Then
prevYear = nYear-1
Else
prevYear = nYear
End If
%>&nYear=<%=prevYear%>','m
onthCal','
');"><inpu
t type="button" value=">>" name="nextMonth" onclick="window.open('calT
est.asp?nM
onth=<%=ne
xtMonth%>
<%
Dim nextYear
If nextMonth=1 Then
nextYear = nYear+1
Else
nextYear = nYear
End If
%>&nYear=<%=nextYear%>','m
onthCal','
');">
</td></tr>
</form>
<tr><td colspan=2>
<table border=0 cellpadding=0 width="224">
<tr>
<td width=27> </td>
<th width=32>Sön</th>
<th width=32>Mån</th>
<th width=32>Tis</th>
<th width=32>Ons</th>
<th width=32>Tor</th>
<th width=32>Fre</th>
<th width=32>Lör</th>
</tr>
<tr>
<%
'Create weeknumber cell
Dim wno : wno = ""
Dim wnoCell : wnoCell = "<td width=27 valign=""top"" bgcolor=""#CECECE"">
" & wno & "<br> <br></td>" & vbCrLf
'First weeknumber cell
Response.write (wnoCell)
' Add blank cells until the proper day
for nDex = 1 to Weekday(dtDate) - 1
Response.Write "<td width=32 bgcolor=""#c0c0c0"">
</td>" & vbCrLf
next
do
Response.Write "<td width=32 valign=""top"" bgcolor=""#ffffc0"">" & Day(dtDate) & "<br> <br>"
Response.Write "</td>" & vbCrLf
if WeekDay(dtDate) = 7 then
Response.Write "</tr>" & vbCrLf & "<tr>" & vbCrLf & wnoCell
end if
dtDate = DateAdd("d", 1, dtDate)
loop until (Month(dtDate) <> CInt(nMonth))
' Add blank cells to fill out the rest of the month if needed
if Weekday(dtDate) <> 1 then
for nDex = Weekday(dtDate) to 7
Response.Write "<td width=32 bgcolor=""#C0C0C0"">
</td>"
next
end if
%>
</tr>
</table>
<%
DoFooter("Home")
%>
--------------------------
----------
-----
END CODE
--------------------------
----------
-----
Start Free Trial