Tutoriales de asp

Hola amigos aquí esta una función que te devuelve una tabla con el calendario del día que le mandes o sino del día actual.

Checalo Si tienes alguna duda sobre este tutorial visita el foro.

<%
function calendar(today)
         if isnull(today) then
            today = date
         end if                  
           
         today = DateValue(today)                          
           
         todays_day = day(today)
         todays_month = month(today)   
         todays_year = year(today)        
        
         month_names = Array("January", _
                             "February", _
                             "March", _
                             "April", _
                             "May", _
                             "June", _
                             "July", _
                             "August", _
                             "September", _
                             "October", _
                             "November", _
                             "December")                                     
                 
         this_month = datevalue(todays_month & "/1/" & todays_year)                          
         next_month = datevalue(dateadd("m", 1, todays_month &  "/1/" & todays_year))
        
         'Find out when this month starts and ends.        
         first_week_day = weekday(this_month) - 1                 
        
         days_in_this_month = datediff("d", this_month, next_month)                 
                         
         calendar_html = "<table style=""background-color:666699; color:ffffff;"">"
        
         calendar_html = calendar_html & _
                         "<tr><td colspan=""7"" align=""center"" style=""background-color:9999cc; color:000000;"">" & _
                         month_names(todays_month - 1) & " " & todays_year & "</td></tr>"
                          
         calendar_html = calendar_html & "<tr>"
         
         'Fill the first week of the month with the appropriate number of blanks.      
         for week_day = 0 to first_week_day - 1           
             calendar_html = calendar_html & "<td style=""background-color:9999cc; color:000000;"">&nbsp;</td>"  
         next
           
         week_day = first_week_day
         for day_counter = 1 to days_in_this_month          
             week_day = week_day mod 7
           
             if week_day = 0 then
                calendar_html = calendar_html & "</tr><tr>"
             end if
           
             'Do something different for the current day.
             if todays_day = day_counter then
                calendar_html = calendar_html & "<td align=""center""><b>" & day_counter & "</b></td>"
             else
                calendar_html = calendar_html & _
                                "<td align=""center"" style=""background-color:9999cc; color:000000;"">&nbsp;" & _
                                day_counter & "&nbsp;</td>"
             end if
           
             week_day = week_day + 1
         next
           
         calendar_html = calendar_html & "</tr>"
         calendar_html = calendar_html & "</table>"
                  
         Calendar = calendar_html
end function
%>

Descarga el ejemplo abajo.

Autor: jair DescargarDescargar

Comentarios en "Crear un calendario en asp"

Table 'programa_programas.t_comentarios' doesn't exist