Ver Mensaje Individual
  #4 (permalink)  
Antiguo 14/07/2010, 02:07
Avatar de Gustavo72
Gustavo72
 
Fecha de Ingreso: abril-2008
Ubicación: -32.956045,-60.661355
Mensajes: 197
Antigüedad: 16 años
Puntos: 9
Respuesta: convertir fecha

Probá con esta función:

Código PHP:
<?php
$f
="martes, 13 de julio de 2010";
$fSQL=convertirFecha($f);

function 
convertirFecha($fecha) {
     
$fecha=preg_replace(array("/^[a-zéá]+\, /i""/ de[l]? /i""/enero/i""/febrero/i""/marzo/i""/abril/i""/mayo/i""/junio/i""/julio/i""/agosto/i""/septiembre/i""/octubre/i""/noviembre/i""/diciembre/i"), array("""-""01""02""03""04""05""06""07""08""09""10""11""12"), trim($fecha));
     if (
strlen($fecha)==9$fecha="0$fecha";
     
$fecha=substr($fecha64)."-".substr($fecha32)."-".substr($fecha02);
     return 
$fecha;
}
?>
__________________
Saludos.

Gustavo

Última edición por Gustavo72; 14/07/2010 a las 17:41