Ver Mensaje Individual
  #3 (permalink)  
Antiguo 03/12/2015, 21:15
tvreal28
 
Fecha de Ingreso: noviembre-2015
Mensajes: 21
Antigüedad: 8 años, 5 meses
Puntos: 0
Respuesta: PHP Cambiar fecha cadena a date

amigo pero tu lo estas haciendo con un tipo date y ademas agregando una fecha determinada

y yo lo tengo en un varchar

y están guardados de esta manera Año-Mes-Dia 2015-12-31

y lo que quiero es que se muestre Mes y año para mostrarlo en un listado
por ejemplo Enero del 2015
pero extrayendolo de mi bd el campo se llama icr_fecha_revision2

Código PHP:
<?php
require_once('conexion.php');
if (isset(
$_POST['busc'])){
$fecha_reporte=$_POST['fecha_reporte'];
$fecha_reporte2=$_POST['fecha_reporte2'];

$sql="select * from tbldocumentosicr INNER JOIN tblinfracciones ON tbldocumentosicr.icr_infraccion=tblinfracciones.icr_infraccion where icr_fecha_ri>='$fecha_reporte' and icr_fecha_ri<='$fecha_reporte2' order by icr_fecha_ri ASC";
}else{
$sql="select * from tbldocumentosicr INNER JOIN tblinfracciones ON tbldocumentosicr.icr_infraccion=tblinfracciones.icr_infraccion where icr_estado='5' order by icr_fecha_ri ASC";
}

$reg=mysql_query($sql,$cnx);
?>
<html>
<head>
<title>Listado</title>
</head>
<body>
<form action="reportlima.php" method="POST" >
<table BGCOLOR="F9FBFC" BORDERCOLOR=""  BORDER=5 width="100%"  align="center" cellspacing="0">
<tr>
<td colspan=14 align="center" bgcolor="#FFFFFF"><h2><strong></strong></h2></td>
</tr>
<tr>

<td BGCOLOR="C1D4D6" width="90" align=center><h5>PERIODOS DE REVISION</h5></td> 

</tr>
<?php
$i
=0;
while(
$res=mysql_fetch_array($reg)){
    
?>
<tr style="background-color:#f0f0f0" id="<?php echo $i;?>" onMouseMove="cambiar('<?php echo $i;?>','#cccccc')" onMouseOut="cambiar('<?php echo $i;?>','#f0f0f0')">
    

<!--- [b]AQUI ES DONDE DEBERIA AGREGAR EL CODIGO[/b] --->

// ASI ES COMO LO EXTRAIGO DE LA BD

<td width="90" align=center><?php echo $res['icr_fecha_revision2'];?></td>

--->

</tr>
    <?php
    $i
=$i+1;
    }
    
?>
</table>
</body>
</html>