Foros del Web » Programando para Internet » PHP »

crear calendario desde una fecha inicio una final

Estas en el tema de crear calendario desde una fecha inicio una final en el foro de PHP en Foros del Web. tengo este script que genera del mes actual @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); Código PHP: Ver original <?php //This gets today's date $date = time ( ) ; ...
  #1 (permalink)  
Antiguo 06/09/2010, 23:49
Avatar de chalchis  
Fecha de Ingreso: julio-2003
Mensajes: 1.773
Antigüedad: 20 años, 9 meses
Puntos: 21
Pregunta crear calendario desde una fecha inicio una final

tengo este script que genera del mes actual

Código PHP:
Ver original
  1. <?php
  2. //This gets today's date
  3. $date =time () ;  //This puts the day, month, and year in seperate variables  
  4. $day = date('d', $date) ;  
  5. $month = date('m', $date) ;  
  6. $year = date('Y', $date) ;  
  7. //Here we generate the first day of the month  
  8. $first_day = mktime(0,0,0,$month, 1, $year) ;   //This gets us the month name  
  9. $title = date('F', $first_day) ;
  10. $day_of_week = date('D', $first_day) ;
  11. switch($day_of_week)
  12. {  
  13.     case "Sun": $blank = 0;
  14.     break;  
  15.     case "Mon": $blank = 1;
  16.     break;  
  17.     case "Tue": $blank = 2;
  18.     break;  
  19.     case "Wed": $blank = 3;
  20.     break;  
  21.     case "Thu": $blank = 4;
  22.     break;  
  23.     case "Fri": $blank = 5;
  24.     break;  
  25.     case "Sat": $blank = 6;
  26.      break;  
  27. }  //We then determine how many days are in the current month
  28. $days_in_month = cal_days_in_month(0, $month, $year) ;
  29.  
  30. echo "<table border=1 width=294>";
  31. echo "<tr><th colspan=7> $title $year </th></tr>";
  32. echo "<tr><td width=42>S</td><td width=42>M</td><td width=42>T</td><td width=42>W</td><td width=42>T</td><td width=42>F</td><td width=42>S</td></tr>";  //This counts the days in the week, up to 7
  33. $day_count = 1;  
  34. echo "<tr>"; //first we take care of those blank days
  35. while($blank > 0 )  
  36. {  
  37.     echo "<td>-</td>";  $blank = $blank-1;  
  38.     $day_count++;
  39. }
  40.  
  41. $day_num = 1;  //count up the days, untill we've done all of them in the month
  42. while ( $day_num <= $days_in_month )  
  43. {  
  44.     echo "<td>".$day_num."*</td>";
  45.  
  46.    
  47.     $day_num++;  $day_count++;  //Make sure we start a new row every week
  48.     if ($day_count > 7)
  49.     {
  50.         echo "</tr><tr>"; $day_count = 1;
  51.     }
  52. }
  53.  
  54. //Finaly we finish out the table with some blank details if needed
  55. while ( $day_count >1 && $day_count <=7 )  
  56. {  
  57.     echo "<td>-</td>";  $day_count++;  
  58. }  
  59. echo "</tr></table>";
  60. ?>


mi pregunta es como puedo generar mas filas y columnas si en caso de que la fecha termino llegara hasta el siguiente mes por ejmplo dia:5 del siguiete mes

como podria aumentar la caudricula hasta llegar esa fecha tope


saludos espero sus comentarios

gracias
__________________
gerardo
  #2 (permalink)  
Antiguo 07/09/2010, 00:00
Avatar de chalchis  
Fecha de Ingreso: julio-2003
Mensajes: 1.773
Antigüedad: 20 años, 9 meses
Puntos: 21
Respuesta: crear calendario desde una fecha inicio una final

otro ejemplo seria asi pero que llegue hasta la fecha deseada

http://eisabainyo.net/demo/jquery.calendar-widget.php
__________________
gerardo

Etiquetas: calendario, final, inicio, fechas
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 22:18.