Filter month with date date (Y-m-d)

0

Previously I made the date division date ("Ymd"), because I wanted to print only the month, then I printed it in number and I made the modification to pass it with the letters of the month, now I have a filter an input type=" mont "which I want to select a month I throw the list of all the months I search from my filter, how do I do it? /// here is my input that is my filter

   <td>Mes:<input value="Mes"type="month" name="mes" id="mes"></td> 
   <td><input type="submit" value="Mostrar" name="mostrar" id="mostrar" >
    <?php
//mi consulta para comparar el input filtro y el campo fecha que esta en mi base
  if(($_POST['mes']=="") && ($_POST[$nombremes]==""))
  {
      $consulta="";
  }else
  {
      $consulta="AND date_format(s.fecha,'%m') BETWEEN '".$_POST['mes']."' AND '".$_POST["s.fecha"]."'";
  }
  /*
 echo $_POST['mes'] ;
 */
    $so ="SELECT s.Id_folio, s.fecha,d.id_departamento,g.Id_gerencia,g.Nombre_gerencia, d.nombre,s.descripcion_trabajo, s.observaciones, s.Id_servicio,s.tipo_solicitud, s.costo,  s.id_vehiculo, u.Empleado_Nombre, u.Empleado_id, t.Id_servicio, t.Nombre_servicio,s.Autoriza_Soli,s.Autoriza_Ger,s.Autoriza_GerIs,s.Autoriza_trab,s.Autoriza_termi FROM solicitud as s, departamento as d ,gerencias as g,usuarios as u, tipo_servicio as t  WHERE s.id_departamento=d.id_departamento and s.Empleado_id =u.Empleado_id and s.Id_servicio =t.Id_servicio and d.id_gerencia=g.Id_gerencia and Autoriza_Soli=1 and Autoriza_Ger =2 and Autoriza_GerIs=3 and Autoriza_trab=4 and Autoriza_termi=5 ".$consulta."";
     //division de mi fecha y pasarla a letras el mes
    $mostrarso=mysql_query($so);
    while($i=mysql_fetch_array($mostrarso)){
    date_default_timezone_set('Europe/Madrid');
    setlocale(LC_TIME, 'es_ES.UTF-8');
    setlocale(LC_TIME, 'spanish');
    $nombremes=strftime("%B", strtotime($fecha_mes=$i[1]));
    $fecha_mes=$i[1];
    $partes = explode('-', $fecha_mes);
    $_fecha = "{$partes[2]}-{$partes[1]}-{$partes[0]} "
?>
 <td><?php echo $nombremes;?></td>
    
asked by Esther 17.11.2018 в 00:50
source

0 answers