how to remove Sunday from my horizontal php calendar?

0

I have designed a horizontal calendar that shows me the days according to the month, according to a range that I give these days are marked by an image, what I do not know how to do is not to mark me on Sundays

this is my calendar

this code

<?php 
date_default_timezone_set('America/Bogota');
setlocale( LC_TIME, 'spanish' );
include 'conexionbd.php';

$meses=['ENERO','FEBRERO','MARZO','ABRIL','MAYO','JUNIO','JULIO','AGOSTO','SETIEMBRE','OCTUBRE','NOVIEMBRE','DICIEMBRE'];

$fecha1 = "2017-07-28";
$fecha2 = "2018-11-24";

$datosfechain = explode("-",$fecha1);
$añoin = $datosfechain[0];
$mesein = $datosfechain[1];
$dian = $datosfechain[2];

$datosfechafin = explode("-",$fecha2);
$añofin = $datosfechafin[0];
$mesfin = $datosfechafin[1];
$diafin = $datosfechafin[2];

$diferenciaaños=$añofin-$añoin;


if($diferenciaaños>0){
    $difereciameses = (12-$mesein)+1+(12*$difereciameses)+$mesfin;
}else
{
    $difereciameses = $mesfin-$mesein+1;
}




$consulta_calendario = "SELECT cod_dia, fecha from calendario where fecha>='$fecha1' and fecha<='$fecha2'  and cod_frec_dia='1'";

$resultado_consulta = mysqli_query($conexion,$consulta_calendario);



//echo $consulta_calendario;
//echo $añofin."  ".$añoin." ".$diferenciaaños." ".$mesfin." ".$mesein." ".$difereciameses." ".$dian;

echo "desde : ".$fecha1." hasta : " .$fecha2;



?>

<table class="table table-striped">
            <thead>
                <tr style="background-color: gray;color: white">
                    <th>MES/AÑO</th>
                    <th colspan="31" style="text-align: center;">DIA</th>                   
                    <th colspan="3" style="text-align: center;">DOSIS MENSUAL</th>              
                </tr>
                <tr style="font-size: 12px">
                    <th></th>
                    <th>1</th>
                    <th>2</th>
                    <th>3</th>
                    <th>4</th>
                    <th>5</th>
                    <th>6</th>
                    <th>7</th>
                    <th>8</th>
                    <th>9</th>
                    <th>10</th>
                    <th>11</th>
                    <th>12</th>
                    <th>13</th>
                    <th>14</th>
                    <th>15</th>
                    <th>16</th>
                    <th>17</th>
                    <th>18</th>
                    <th>19</th>
                    <th>20</th>
                    <th>21</th>
                    <th>22</th>
                    <th>23</th>
                    <th>24</th>
                    <th>25</th>
                    <th>26</th>
                    <th>27</th>
                    <th>28</th>
                    <th>29</th>
                    <th>30</th>
                    <th>31</th>
                    <th>Mensual</th>
                    <th>Acumulado</th>
                    <th>Faltas</th>
                </tr>

            </thead>
            <tbody> 
  <?php 



     for($i=0;$i<$difereciameses;$i++)
  {

   ?>
       <tr id="<?php echo $i; ?>">
       <td><?php echo $meses[$mesein-1]."/".$añoin;?></td>

               <?php 

                     for($j=1;$j<=date( 't', strtotime( $añoin."-".$mesein ));$j++)
                 {

                ?>      
                   <?php if($i<1)
                     {
                    ?>
                       <?php
                           if($j>=$dian)
                           {
                         ?>
                    <td id="<?php echo  $fila["fecha"]; ?>"><img width=65% src="img/accept.png"></td>
                        <?php
                           }else{
                          ?>
                    <td id="<?php echo $fila["fecha"];  ?>"></td>
                          <?php
                           }
                            ?>
                    <?php
                      }else if($i>$difereciameses-2){
                            if($j<=$diafin)
                            {
                      ?> 
                           <td><img width=65% src="img/accept.png"></td>
                         <?php 
                             }
                         }else{
                          ?>

                    <td><img width=65% src="img/accept.png"></td>
                      <?php 
                                }
                       ?>
                     <?php 
                     }            
                                    ?>
                <?php 



                ?>
             </tr>
                <?php 
                     if($mesein==12){
                        $mesein=0;
                        $añoin++;
                     }
                      $mesein++;
                //     echo "meses ".$mesein;
                   }


                 ?>


            </tbody>
</table>    
    
asked by ingswsm 03.07.2017 в 22:53
source

1 answer

0

You need in your php to have control over the days something like this:

function isweekend($date){
    $date = strtotime($date);
    $date = date("l", $date);
    $date = strtolower($date);
    echo $date;
    if($date == "sunday") {
        return "true";
    } else {
        return "false";
    }
}

if the date falls on Sunday it will return a true and if the variable is true you can say that it does not add it to the calendar.

    
answered by 03.07.2017 в 23:02