Ver Mensaje Individual
  #3 (permalink)  
Antiguo 27/03/2008, 16:13
Avatar de pato12
pato12
 
Fecha de Ingreso: septiembre-2007
Ubicación: Salta
Mensajes: 1.620
Antigüedad: 17 años, 4 meses
Puntos: 101
Re: Calendario Php

Hola,
Encontre este codigo. Espero que te sirba:
Código PHP:
<?php
  $sel_date 
= isset($_REQUEST['sel_date']) ? $_REQUEST['sel_date'] : time();
  if( isset(
$_POST['hrs']) ){
     
$t getdate($sel_date);
     
$sel_date mktime($_POST['hrs'], $_POST['mins'], $t['seconds'], $t['mon'], $t['mday'], $t['year']);
  }
  
$t getdate($sel_date);
  
$start_date mktime($t['hours'], $t['minutes'], $t['seconds'], $t['mon'], 1$t['year']);
  
$start_date -= 86400 date('w'$start_date);
  
  
$prev_year mktime($t['hours'], $t['minutes'], $t['seconds'], $t['mon'], $t['mday'], $t['year'] - 1);
  
$prev_month mktime($t['hours'], $t['minutes'], $t['seconds'], $t['mon'] - 1$t['mday'], $t['year']);
  
$next_year mktime($t['hours'], $t['minutes'], $t['seconds'], $t['mon'], $t['mday'], $t['year'] + 1);
  
$next_month mktime($t['hours'], $t['minutes'], $t['seconds'], $t['mon'] + 1$t['mday'], $t['year']);
?>
<form method="post">
<table width="180" border="0" cellspacing="1" 
  style="border: 1px solid black; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; text-align: center">
  <tr> 
    <td width="14%" bgcolor="#66FF99">
       <a href="?sel_date=<?= $prev_year ?>" style="text-decoration: none" title="Prevous Year">&lt;&lt;</a></td>
    <td width="14%" bgcolor="#66FF99">
       <a href="?sel_date=<?= $prev_month ?>" style="text-decoration: none" title="Prevous Month">&lt;</a></td>
    <td colspan="3" bgcolor="#66FF99">
       <?= date('M Y'$sel_date?>
    </td>
    <td width="14%" bgcolor="#66FF99">
       <a href="?sel_date=<?= $next_month ?>" style="text-decoration: none" title="Next Month">&gt;</a></td>
    <td width="14%" bgcolor="#66FF99">
       <a href="?sel_date=<?= $next_year ?>" style="text-decoration: none" title="Next Year">&gt;&gt;</a></td>
  </tr>
  <tr> 
    <td bgcolor="#0099FF">Sun</td>
    <td bgcolor="#0099FF">Mon</td>
    <td width="14%" bgcolor="#0099FF">Tue</td>
    <td width="14%" bgcolor="#0099FF">Wed</td>
    <td width="14%" bgcolor="#0099FF">Thu</td>
    <td bgcolor="#0099FF">Fri</td>
    <td bgcolor="#0099FF">Sat</td>
  </tr>
  <?php
     $day 
1;
     for(
$i $start_date$day <= 42$i+=86400$day++){
        if( 
$day == ) echo "<tr>\n";        
        if( 
$t['mon'] == date('n'$i ) )
           if( 
$i == $sel_date )
              echo 
' <td bgcolor="gold">'date('j'$i) ."</td>\n";
           else
              echo 
' <td><a href="?sel_date='$i .'" style="text-decoration: none">'date('j'$i) ."</a></td>\n";
        else
           echo 
' <td ><a href="?sel_date='$i .'" style="text-decoration: none"><font  color="silver">'date('j'$i) ."</font></a></td>\n";                
        if( 
$day == )  echo "</tr>\n";
     }
  
?>
  <tr>
    <td colspan="7" align="left" bgcolor="silver">Time:
    <select name="hrs" onchange="document.forms[0].submit()">
    <?php
       
for($i 0$i 24$i++)
          echo 
'   <option '. (date('G'$sel_date)==$i 'selected':'') .'>'sprintf('%02d'$i) ."</option>\n";
    
?>
    </select>:
    <select name="mins" onchange="document.forms[0].submit()">
    <?php
        
for($i 0$i 60$i++)
           echo 
'   <option '. (date('i'$sel_date)==$i 'selected':'') .'>'sprintf('%02d'$i) ."</option>\n";
    
?>
    </select> hrs
    <input type="hidden" name="sel_date" value="<?= $sel_date ?>">    
    </td>
  </tr>
</table>
</form>
Gracias
Salu2
__________________
Half Music - www.halfmusic.com