Ver Mensaje Individual
  #2 (permalink)  
Antiguo 12/03/2006, 10:39
Avatar de sjam7
sjam7
 
Fecha de Ingreso: diciembre-2001
Ubicación: Guadalajara, Mexico
Mensajes: 3.672
Antigüedad: 23 años, 4 meses
Puntos: 16
Bueno,yo uso este que saca eventos de una base de datos access y ademas marca algunos dias festivos de Mexico
Código:
<%
RS2 = Server.MapPath("base.mdb")
Set conexion2 = Server.CreateObject("ADODB.Connection")
conexion2.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & RS2 & ";"
Set RS2 = Server.CreateObject("ADODB.Recordset")

Function GetDaysInMonth(iMonth, iYear)
    Dim dTemp
    dTemp = DateAdd("d", -1, DateSerial(iYear, iMonth + 1, 1))
    GetDaysInMonth = Day(dTemp)
End Function

Function GetWeekdayMonthStartsOn(dAnyDayInTheMonth)
    Dim dTemp
    dTemp = DateAdd("d", -(Day(dAnyDayInTheMonth) - 1), dAnyDayInTheMonth)
    GetWeekdayMonthStartsOn = WeekDay(dTemp)
End Function

Function SubtractOneMonth(dDate)
    SubtractOneMonth = DateAdd("m", -1, dDate)
End Function

Function AddOneMonth(dDate)
    AddOneMonth = DateAdd("m", 1, dDate)
End Function


Dim dDate     
Dim iDIM      
Dim iDOW     
Dim iCurrent  
Dim iPosition 


If IsDate(Request.QueryString("date")) Then
    dDate = CDate(Request.QueryString("date"))
Else
    If IsDate(Request.QueryString("month") & "-" & Request.QueryString("day") & "-" & Request.QueryString("year")) Then
        dDate = CDate(Request.QueryString("month") & "-" & Request.QueryString("day") & "-" & Request.QueryString("year"))
    Else
        dDate = Date()
        ' The annoyingly bad solution for those of you running IIS3
        If Len(Request.QueryString("month")) <> 0 Or Len(Request.QueryString("day")) <> 0 Or Len(Request.QueryString("year")) <> 0 Or Len(Request.QueryString("date")) <> 0 Then
            Response.Write "La fecha seleccionada no es valida.  El calendario regresa al dia de hoy.<BR><BR>"
        End If
        ' The elegant solution for those of you running IIS4
        'If Request.QueryString.Count <> 0 Then Response.Write "The date you picked was not a valid date.  The calendar was set to today's date.<BR><BR>"
    End If
End If

mes=Month(CDate(dDate))
if mes=1 then mesactual="Enero"
if mes=2 then mesactual="Febrero"
if mes=3 then mesactual="Marzo"
if mes=4 then mesactual="Abril"
if mes=5 then mesactual="Mayo"
if mes=6 then mesactual="Junio"
if mes=7 then mesactual="Julio"
if mes=8 then mesactual="Agosto"
if mes=9 then mesactual="Septiembre"
if mes=10 then mesactual="Octubre"
if mes=11 then mesactual="Noviembre"
if mes=12 then mesactual="Diciembre"

'MonthName(Month(dDate))
'Now we've got the date.  Now get Days in the choosen month and the day of the week it starts on.
iDIM = GetDaysInMonth(Month(dDate), Year(dDate))
iDOW = GetWeekdayMonthStartsOn(dDate)


%>
<!-- Outer Table is simply to get the pretty border-->

<TABLE width="150" BORDER=0 CELLPADDING=0 CELLSPACING=0>
  <TR>
<TD>
<TABLE width="150" BORDER=0 CELLPADDING=0 CELLSPACING=1 class="bordenegroTODO">
        <TR bgcolor="#CCCCCC"> 
          <TD ALIGN="center" COLSPAN=7> 
            <TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=0>
              <TR background="images/fondotoptabla.gif"> 
                <TD width="29%" height="20" ALIGN="left" background="images/fondotoptabla.gif"><A HREF="agenda.asp?date=<%= SubtractOneMonth(dDate)%>" alt="Ir al mes anterior"><FONT COLOR=#000099 SIZE="1" face="Arial, Verdana, Helvetica, sans-serif"><b>&lt;&lt; 
                  </b></FONT></A></TD>
                <TD width="43%" ALIGN="center" background="images/fondotoptabla.gif"><FONT COLOR=#000099 size="2" face="Arial, Verdana, Helvetica, sans-serif"><B><%=mesactual%></B></FONT></TD>
                <TD width="28%" ALIGN="right" background="images/fondotoptabla.gif"><A HREF="agenda.asp?date=<%= AddOneMonth(dDate)%>" alt="Ir al siguiente mes"><FONT COLOR=#000099 SIZE="1" face="Arial, Verdana, Helvetica, sans-serif"><b> 
                  &gt;&gt;</b></FONT></A></TD>
              </TR>
            </TABLE></TD>
        </TR>
        <TR valign="middle" bgcolor="#CCCCCC"> 
          <TD height="20" ALIGN="center" background="images/fondotoptabla.gif" class="bordenegroTODO"><FONT COLOR=#000000 size="1" face="Arial, Verdana, Helvetica, sans-serif"><B>D</B></FONT></TD>
          <TD height="20" ALIGN="center" background="images/fondotoptabla.gif" class="bordenegroTODO"><FONT COLOR=#000000 size="1" face="Arial, Verdana, Helvetica, sans-serif"><B>L</B></FONT></TD>
          <TD height="20" ALIGN="center" background="images/fondotoptabla.gif" class="bordenegroTODO"><FONT COLOR=#000000 size="1" face="Arial, Verdana, Helvetica, sans-serif"><B>M</B></FONT></TD>
          <TD height="20" ALIGN="center" background="images/fondotoptabla.gif" class="bordenegroTODO"><FONT COLOR=#000000 size="1" face="Arial, Verdana, Helvetica, sans-serif"><B>M</B></FONT></TD>
          <TD height="20" ALIGN="center" background="images/fondotoptabla.gif" class="bordenegroTODO"><FONT COLOR=#000000 size="1" face="Arial, Verdana, Helvetica, sans-serif"><B>J</B></FONT></TD>
          <TD height="20" ALIGN="center" background="images/fondotoptabla.gif" class="bordenegroTODO"><FONT COLOR=#000000 size="1" face="Arial, Verdana, Helvetica, sans-serif"><B>V</B></FONT></TD>
          <TD height="20" ALIGN="center" background="images/fondotoptabla.gif" class="bordenegroTODO"><FONT COLOR=#000000 size="1" face="Arial, Verdana, Helvetica, sans-serif"><B>S</B></FONT></TD>
        </TR>
        <%
If iDOW <> 1 Then
    Response.Write vbTab & "<TR>" & vbCrLf
    iPosition = 1
    Do While iPosition < iDOW
        Response.Write vbTab & vbTab & "<TD>&nbsp;</TD>" & vbCrLf
        iPosition = iPosition + 1
    Loop
End If

iCurrent = 1
iPosition = iDOW
Do While iCurrent <= iDIM
    If iPosition = 1 Then
        Response.Write vbTab & "<TR>" & vbCrLf
    End If

    if iPosition=1 then
     fondo="#eeeeee"
    else
     fondo=""
    end if 

'ESTO ES LO DE LOS DIAS FESTIVOS, SE PONE EL DIA Y EL NUMERO DE MES
if iCurrent = "5" and Month(dDate)="5" then
     fondo="#CCCCCC"
elseif iCurrent = "16" and Month(dDate)="9" then
     fondo="#CCCCCC"
elseif iCurrent = "1" and Month(dDate)="1" then
     fondo="#CCCCCC"
elseif iCurrent = "25" and Month(dDate)="12" then
     fondo="#CCCCCC"
elseif iCurrent = "5" and Month(dDate)="2" then
     fondo="#CCCCCC"
end if


    
    If iCurrent = Day(dDate) Then
        Response.Write vbTab & vbTab & "<TD class=bordenegroTODO onmouseover=""this.style.background='#eeeeee'"" onmouseout=""this.style.background='#eeeeee'"" width=18 height=20 ALIGN=center BGCOLOR=#ff6666 background=images/fondotoptabla.gif><A HREF=""./agenda.asp?date=" & iCurrent & "-" & Month(dDate) & "-" & Year(dDate) & """ class=a2><FONT face=""Verdana"" SIZE=""1"" COLOR=#000099><b>" & iCurrent & "</b></FONT></A></TD>" & vbCrLf
    Else
        fechahoy= iCurrent & "/" & Month(dDate) & "/" & Year(dDate)
        SQL2="SELECT * FROM eventos WHERE fecha=#"&fechahoy&"# order by fecha"
        RS2.Open SQL2,conexion2,2,3,1
        if not rs2.eof then
        Response.Write vbTab & vbTab & "<TD class=bordenegroTODO onmouseover=""this.style.background='#3D87CA'"" onmouseout=""this.style.background='#3D87CA'"" width=18 height=20 ALIGN=center BGcolor=#3D87CA><A HREF=""./agenda.asp?date=" & iCurrent & "-" & Month(dDate) & "-" & Year(dDate) & """ class=a2><FONT face=""Verdana"" SIZE=""1"" color=#ffffff>" & iCurrent & "</FONT></A></TD>" & vbCrLf
        else
        Response.Write vbTab & vbTab & "<TD onmouseover=""this.style.background='#66FFCC'"" onmouseout=""this.style.background='"&fondo&"'"" width=18 height=20 ALIGN=center BGcolor="&fondo&"><A HREF=""./agenda.asp?date=" & iCurrent & "-" & Month(dDate) & "-" & Year(dDate) & """ class=a2><FONT face=""Verdana"" SIZE=""1"">" & iCurrent & "</FONT></A></TD>" & vbCrLf
        end if
        rs2.close
    End If
    
    If iPosition = 7 Then
        Response.Write vbTab & "</TR>" & vbCrLf
        iPosition = 0
    End If
    
    iCurrent = iCurrent + 1
    iPosition = iPosition + 1
Loop

If iPosition <> 1 Then
    Do While iPosition <= 7
        Response.Write vbTab & vbTab & "<TD>&nbsp;</TD>" & vbCrLf
        iPosition = iPosition + 1
    Loop
    Response.Write vbTab & "</TR>" & vbCrLf
End If
%>
      </TABLE>
</TD>
</TR>
</TABLE>
<table height="5" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td></td>
  </tr>
</table>
<table width="150" border="0" cellspacing="2" cellpadding="0">
  <tr> 
    <td width="18" height="20" bgcolor="#CCCCCC" class="bordenegroTODO"><font size="1" face="Arial, Verdana, Helvetica, sans-serif">&nbsp;</font></td>
    <td width="126" height="20"><font size="1" face="Arial, Verdana, Helvetica, sans-serif">&nbsp;Dia 
      festivo</font></td>
  </tr>
  <tr> 
    <td height="20" bgcolor="#eeeeee" class="bordenegroTODO"><font size="1" face="Arial, Verdana, Helvetica, sans-serif">&nbsp;</font></td>
    <td height="20"><font size="1" face="Arial, Verdana, Helvetica, sans-serif">&nbsp;Domingo</font></td>
  </tr>
  <tr> 
    <td height="20" bgcolor="#3D87CA" class="bordenegroTODO"><font size="1" face="Arial, Verdana, Helvetica, sans-serif">&nbsp;</font></td>
    <td height="20"><font size="1" face="Arial, Verdana, Helvetica, sans-serif">&nbsp;Dia 
      con evento</font></td>
  </tr>
  <tr> 
    <td height="20" bgcolor="#66FFCC" class="bordenegroTODO"><font size="1" face="Arial, Verdana, Helvetica, sans-serif">&nbsp;</font></td>
    <td height="20"><font size="1" face="Arial, Verdana, Helvetica, sans-serif">&nbsp;Puntero</font></td>
  </tr>
  <tr> 
    <td height="20" background="images/fondotoptabla.gif" class="bordenegroTODO"><font size="1" face="Arial, Verdana, Helvetica, sans-serif">&nbsp;</font></td>
    <td height="20"><font size="1" face="Arial, Verdana, Helvetica, sans-serif">&nbsp;Dia 
      actual </font></td>
  </tr>
</table>
Este lo puedes ver funcionando en www.parasuevento.com entra a Agenda o bien en www.bosquepinardelaventa.com es el mismo, espero te sirva o por lo menos para que veas ideas