Foros del Web » Programando para Internet » PHP »

problema al pasar fecha a celda en excel

Estas en el tema de problema al pasar fecha a celda en excel en el foro de PHP en Foros del Web. Hola Compañeros. Veran, realizo una consulta donde los resultados son guardados en excel donde tengo 3 campos que son fechas, mi problema es que esos ...
  #1 (permalink)  
Antiguo 02/08/2013, 09:32
 
Fecha de Ingreso: enero-2012
Mensajes: 64
Antigüedad: 12 años, 2 meses
Puntos: 0
problema al pasar fecha a celda en excel

Hola Compañeros. Veran, realizo una consulta donde los resultados son guardados en excel donde tengo 3 campos que son fechas, mi problema es que esos campos en el archivo, la fecha me la ordena como mm/dd/yyyy, cuando necesito que los ordene como dd/mm/yyyy, y al hacer la consulta desde consola, la fecha esta en el formato que necesito, no se porque hace eso al pasarlo a excel. les dejo el codigo que tengo hasta el momento.

Código PHP:
Ver original
  1. <?
  2. header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");  
  3. header ("Last-Modified: " . gmdate("D,d M YH:i:s") . " GMT");  
  4. header ("Cache-Control: no-cache, must-revalidate");  
  5. header ("Pragma: no-cache");
  6. header("Content-type: application/vnd.ms-excel; name='excel'");
  7. header("Content-Disposition: attachment; filename=Siadcell".date(dMy).".xls");
  8.  
  9.  
  10. include "include/conexionifx.php";
  11. $query = "
  12. select
  13. t02id,c06_desc,c04_cia,t01_marca,t01_modelo,c05_plancia,
  14. t01_serie,t01_numcel,t02_usu,t02_nombre,t02_puesto,
  15. t02_ctocosto,t02_fasig,t02_origen,t94_fechaini,
  16. t94_fechafin, t02_fbaja
  17.  
  18. from t02telusu,t01telefono, C06PLAZAS, c05planes, c04ciatel, t94_vadendum
  19.  
  20. where t01ID = t02_tel
  21. and t01_plaza = c06id
  22. and t02_plan = c05id
  23. and t01_cia = c04id
  24. and (t02_ctocosto in ('508','509','516','638')
  25. or t02_ctocosto matches '*9999*'
  26. or t02_ctocosto matches '*8888*')
  27. AND t02_status = 'A'
  28. and t01_numcel = t94_telefono
  29. ORDER BY t02id
  30. ";
  31. //echo $query;
  32. $result=ifx_prepare($query,$conecta,IFX_SCROLL);
  33. ifx_do($result);
  34. ?>

Código HTML:
Ver original
  1. <table border="1">
  2.     <tr bgcolor="#66CC66">
  3.     <th>FOLIO</th>
  4.     <th>PLAZA</th>
  5.     <th>COMPAÑIA</th>
  6.     <th>MARCA</th>
  7.     <th>MODELO</th>
  8.     <th>PLAN</th>
  9.     <th>IMEI</th>
  10.     <th>LINEA</th>
  11.     <th>NO. EMP.</th>
  12.     <th>NOMBRE</th>
  13.     <th>PUESTO</th>
  14.     <th>CLAVE CC.</th>
  15.     <th>ASIGNADO</th>
  16.     <th>ORIGEN</th>
  17.     <th>CONTRATADO</th>
  18.     <th>VENCIDO</th>
  19.     <th>BAJA</th>
  20.     </tr>
  21.     <?
  22. while($row=ifx_fetch_row($result,"NEXT")){
  23.     ?> 
  24.     <tr>
  25.     <td><? echo $row[t02id];?></td>
  26.     <td><? echo $row[c06_desc];?></td>
  27.     <td><? echo $row[c04_cia];?></td>
  28.     <td><? echo $row[t01_marca];?></td>
  29.     <td><? echo $row[t01_modelo];?></td>
  30.     <td><? echo $row[c05_plancia];?></td>
  31.     <td><? echo $row[t01_serie];?></td>
  32.     <td><? echo $row[t01_numcel];?></td>
  33.     <td><? echo $row[t02_usu];?></td>
  34.     <td><? echo $row[t02_nombre];?></td>
  35.     <td><? echo $row[t02_puesto];?></td>
  36.     <td><? echo $row[t02_ctocosto];?></td>
  37.     <td style = "@"><? echo $row[t02_fasig];?></td>
  38.     <td><? echo $row[t02_origen];?></td>
  39.     <td style = "@"><? echo $row[t94_fechaini];?></td>
  40.     <td style = "@"><? echo $row[t94_fechafin];?></td>
  41.     <td><? echo $row[t02_fbaja];?></td>
  42.     </tr>  
  43.     <?
  44. }
  45. ?>

gracias!!!

Etiquetas: celda, excel, fecha, select
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 09:25.