Ver Mensaje Individual
  #3 (permalink)  
Antiguo 02/06/2004, 10:15
Avatar de Ds1
Ds1
 
Fecha de Ingreso: junio-2003
Mensajes: 87
Antigüedad: 20 años, 10 meses
Puntos: 0
yo me cree la siguiente funcion
=======================================
function fecha($fech){
if ($fech!=""){
for ($x=1; $x<=4; $x++){$fech= str_replace("-","/",$fech); }
if ($fech[2]=="/"){
$tem= split("/",$fech);
$fech = "$tem[2]-$tem[1]-$tem[0]";
}else{
$tem= split("/",$fech);
$fech = "$tem[2]/$tem[1]/$tem[0]";
}
return ($fech);
}
}

==========================================

a la cual le paso una fecha 2004-06-02 y me retorna 02/06/2004 y si le paso
02/06/2004 me retorna 2004-06-02

asi cuando la necesito mostrarcela al usuario lo hago asi 02/06/2004
y cuando la necesito grabar en mysql lo hago asi 2004-06-02

Salu2
ds1