Ayuda! Calendario que comienze en Lunes (adjunto codigo)

19/10/2004 - 17:26 por Karmico | Informe spam
Hola!

Alguien podria hacer que esta calendario comenzara en Lunes?
Copiar, pegar y probar yo estoy loco ya!

Gracias por vuestra ayuda.

<%
'on error resume next
Dim Fiestas(31)
Dim MyMonth 'Month of calendar
Dim MyYear 'Year of calendar
Dim FirstDay 'First day of the month. 1 = Monday
Dim CurrentDay 'Used to print dates in calendar
Dim Col 'Calendar column
Dim Row 'Calendar row

MyMonth = Request.Querystring("m")
MyYear = Request.Querystring("a")

If IsEmpty(MyMonth) then MyMonth = Month(Date)
if IsEmpty(MyYear) then MyYear = Year(Date)

Call ShowHeader (MyMonth, MyYear)

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 "<td>&nbsp;</td>"
elseif CurrentDay > LastDay(MyMonth, MyYear) then
response.write "<td>&nbsp;</td>"
else
response.write "<td"

if MyMonth = Month(Date) and CurrentDay = Day(Date) then
response.write " align=""center"" class=""celda1"">"
else
response.write " align=""center"" class=""celda2"">"
end if

mes = MyMonth
dia = CurrentDay
ano = Myyear

if len(mes) = 1 then
mes = "0"& mes
end if
if len(dia) = 1 then
dia = "0"& dia
end if

fecha = dia & "/" & mes & "/" & ano

if ExisteFecha(fecha) = 1 then
response.write "<a title = """ & Fiestas(clng(CurrentDay)) & """
href=""javascript:Win('eventos.asp?d=" & CurrentDay & "&m=" & MyMonth &
"&a=" & MyYear & "')"" class=""calendario"">" _
& CurrentDay & "</a></td>"
descripcion = null
else
response.write"<small>" & CurrentDay & "</small></td>"
'fin
end if
CurrentDay = CurrentDay + 1
End If

Next
Response.write "<tr>"
Next

response.write "</table>"


' Sub and functions


Sub ShowHeader(MyMonth,MyYear)
%>
<table border="0" width="150" cellspacing="1" cellpadding="0" align="center"
class="borde" bgcolor="#0000AD">
<tr align="center">
<td colspan="7">
<table border="0" width="150" cellspacing="1" cellpadding="0"
bgcolor="#ffffff">
<tr>
<td align="left">
<%
response.write "<a class=""2"" href = ""default.asp?"
if MyMonth - 1 = 0 then
response.write "m&a=" & MyYear -1
else
response.write "m=" & MyMonth - 1 & "&a=" & MyYear
end if
response.write """><small><img border=""0"" src=""images/flechadetras.gif""
alt=""Anterior mes""></a>"
%>
</font>
</td><td align='center'>
<%
response.write " <small><b>" & MonthName(MyMonth) & " " & MyYear &
"</b></small> "
%>
</font>
</td><td align='right'>
<%
response.write "<a class=""2"" href = ""default.asp?"
if MyMonth + 1 = 13 then
response.write "m=1&a=" & MyYear + 1
else
response.write "m=" & MyMonth + 1 & "&a=" & MyYear
end if
response.write """><small><img border=""0"" src=""images/flechadelante.gif""
alt=""Siguiente mes""></font></a>"
%>
</font>
</td></tr></table>
</td>
</tr>
<tr align="center">
<td>
<b><font color ="#FFFFFF">D</font></b></td>
<td>
<b><font color ="#FFFFFF">L</font></b></td>
<td>
<b><font color ="#FFFFFF">M</font></b></td>
<td>
<b><font color ="#FFFFFF">X</font></b></td>
<td>
<b><font color ="#FFFFFF">J</font></b></td>
<td>
<b><font color ="#FFFFFF">V</font></b></td>
<td>
<b><font color ="#FFFFFF">S</font></b></td>
</tr>
<%
End Sub
Function MonthName(MyMonth)
Select Case MyMonth
Case 1
MonthName = "Enero"
Case 2
MonthName = "Febrero"
Case 3
MonthName = "Marzo"
Case 4
MonthName = "Abril"
Case 5
MonthName = "Mayo"
Case 6
MonthName = "Junio"
Case 7
MonthName = "Julio"
Case 8
MonthName = "Agosto"
Case 9
MonthName = "Septiembre"
Case 10
MonthName = "Octubre"
Case 11
MonthName = "Noviembre"
Case 12
MonthName = "Diciembre"
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

'funcion para averiguar si existe evento en esa fecha (esto ignorarlo)
function ExisteFecha(fecha)
ExisteFecha = 0
end function
%>
 

Leer las respuestas

#1 Matias Iacono
19/10/2004 - 17:46 | Informe spam
No creo que puedas hacer que empiese asi nomas ya que, por lo que veo, los
dias en si, son una tabla fija:

<b><font color ="#FFFFFF">D</font></b></td>
<td>
<b><font color ="#FFFFFF">L</font></b></td>
<td>
<b><font color ="#FFFFFF">M</font></b></td>
<td>
<b><font color ="#FFFFFF">X</font></b></td>
<td>
<b><font color ="#FFFFFF">J</font></b></td>
<td>
<b><font color ="#FFFFFF">V</font></b></td>
<td>
<b><font color ="#FFFFFF">S</font></b></td>
</tr>

No son creados dinamicamente.

Saludos

Matias Iacono
Microsoft MVP



"Karmico" wrote in message
news:cl3bka$b7f$
Hola!

Alguien podria hacer que esta calendario comenzara en Lunes?
Copiar, pegar y probar yo estoy loco ya!

Gracias por vuestra ayuda.

<%
'on error resume next
Dim Fiestas(31)
Dim MyMonth 'Month of calendar
Dim MyYear 'Year of calendar
Dim FirstDay 'First day of the month. 1 = Monday
Dim CurrentDay 'Used to print dates in calendar
Dim Col 'Calendar column
Dim Row 'Calendar row

MyMonth = Request.Querystring("m")
MyYear = Request.Querystring("a")

If IsEmpty(MyMonth) then MyMonth = Month(Date)
if IsEmpty(MyYear) then MyYear = Year(Date)

Call ShowHeader (MyMonth, MyYear)

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 "<td>&nbsp;</td>"
elseif CurrentDay > LastDay(MyMonth, MyYear) then
response.write "<td>&nbsp;</td>"
else
response.write "<td"

if MyMonth = Month(Date) and CurrentDay = Day(Date) then
response.write " align=""center"" class=""celda1"">"
else
response.write " align=""center"" class=""celda2"">"
end if

mes = MyMonth
dia = CurrentDay
ano = Myyear

if len(mes) = 1 then
mes = "0"& mes
end if
if len(dia) = 1 then
dia = "0"& dia
end if

fecha = dia & "/" & mes & "/" & ano

if ExisteFecha(fecha) = 1 then
response.write "<a title = """ & Fiestas(clng(CurrentDay)) & """
href=""javascript:Win('eventos.asp?d=" & CurrentDay & "&m=" & MyMonth &
"&a=" & MyYear & "')"" class=""calendario"">" _
& CurrentDay & "</a></td>"
descripcion = null
else
response.write"<small>" & CurrentDay & "</small></td>"
'fin
end if
CurrentDay = CurrentDay + 1
End If

Next
Response.write "<tr>"
Next

response.write "</table>"


' Sub and functions


Sub ShowHeader(MyMonth,MyYear)
%>
<table border="0" width="150" cellspacing="1" cellpadding="0"


align="center"
class="borde" bgcolor="#0000AD">
<tr align="center">
<td colspan="7">
<table border="0" width="150" cellspacing="1" cellpadding="0"
bgcolor="#ffffff">
<tr>
<td align="left">
<%
response.write "<a class=""2"" href = ""default.asp?"
if MyMonth - 1 = 0 then
response.write "m&a=" & MyYear -1
else
response.write "m=" & MyMonth - 1 & "&a=" & MyYear
end if
response.write """><small><img border=""0""


src=""images/flechadetras.gif""
alt=""Anterior mes""></a>"
%>
</font>
</td><td align='center'>
<%
response.write " <small><b>" & MonthName(MyMonth) & " " & MyYear &
"</b></small> "
%>
</font>
</td><td align='right'>
<%
response.write "<a class=""2"" href = ""default.asp?"
if MyMonth + 1 = 13 then
response.write "m=1&a=" & MyYear + 1
else
response.write "m=" & MyMonth + 1 & "&a=" & MyYear
end if
response.write """><small><img border=""0""


src=""images/flechadelante.gif""
alt=""Siguiente mes""></font></a>"
%>
</font>
</td></tr></table>
</td>
</tr>
<tr align="center">
<td>
<b><font color ="#FFFFFF">D</font></b></td>
<td>
<b><font color ="#FFFFFF">L</font></b></td>
<td>
<b><font color ="#FFFFFF">M</font></b></td>
<td>
<b><font color ="#FFFFFF">X</font></b></td>
<td>
<b><font color ="#FFFFFF">J</font></b></td>
<td>
<b><font color ="#FFFFFF">V</font></b></td>
<td>
<b><font color ="#FFFFFF">S</font></b></td>
</tr>
<%
End Sub
Function MonthName(MyMonth)
Select Case MyMonth
Case 1
MonthName = "Enero"
Case 2
MonthName = "Febrero"
Case 3
MonthName = "Marzo"
Case 4
MonthName = "Abril"
Case 5
MonthName = "Mayo"
Case 6
MonthName = "Junio"
Case 7
MonthName = "Julio"
Case 8
MonthName = "Agosto"
Case 9
MonthName = "Septiembre"
Case 10
MonthName = "Octubre"
Case 11
MonthName = "Noviembre"
Case 12
MonthName = "Diciembre"
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

'funcion para averiguar si existe evento en esa fecha (esto ignorarlo)
function ExisteFecha(fecha)
ExisteFecha = 0
end function
%>




Preguntas similares