Ver Mensaje Individual
  #4 (permalink)  
Antiguo 25/01/2016, 16:38
rbczgz
 
Fecha de Ingreso: noviembre-2003
Ubicación: Zaragoza, España
Mensajes: 1.257
Antigüedad: 20 años, 5 meses
Puntos: 154
Respuesta: como podria pasar una fecha a formato español

Hola,

Yo uso estas funciones y me sirven:

Código PHP:
Ver original
  1. ////////////////////////////////////////////////////
  2. //Convierte fecha de mysql a normal, sin la hora
  3. ////////////////////////////////////////////////////
  4.  
  5. function cambiaf_a_normal($fecha){
  6.  
  7.     preg_match( "/([0-9]{2,4})-([0-9]{1,2})-([0-9]{1,2})/", $fecha, $mifecha);
  8.  
  9.     $lafecha=$mifecha[3]."/".$mifecha[2]."/".$mifecha[1];
  10.  
  11.     return $lafecha;
  12.  
  13. }
  14.  
  15. ////////////////////////////////////////////////////////////
  16. //Convierte fecha de mysql a normal, incluyendo la hora
  17. ////////////////////////////////////////////////////////////
  18.  
  19. function cambiafh_a_normal($fecha){
  20.  
  21.     ereg( "([0-9]{2,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $fecha, $mifecha);
  22.  
  23.     $lafecha=$mifecha[3]."/".$mifecha[2]."/".$mifecha[1]." ".$mifecha[4].":".$mifecha[5].":".$mifecha[6];
  24.  
  25.     return $lafecha;
  26.  
  27. }

Espero que te sirvan.