Ver Mensaje Individual
  #13 (permalink)  
Antiguo 05/12/2007, 06:53
Sanubrio
 
Fecha de Ingreso: septiembre-2007
Mensajes: 220
Antigüedad: 17 años, 5 meses
Puntos: 1
Re: A getdate(marca_tiempo) en que formato hay que pasarle la marca de tiempo??

Aunque es mejor y más simple con esas funcione que te dije, si ya lo tienes así:

Código PHP:
function comprobarMiFecha($fecha)
{
    if (!
is_numeric($fecha) || strlen($fecha) != 12)
    {
        return 
false;
    }
    
    return 
true;
}

function 
datosMiFecha($fecha)
{
    if (!
comprobarMiFecha($fecha))
    {
        return 
false;
    }
    
    
$ano    substr($fecha04);
    
$mes    substr($fecha42);
    
$dia    substr($fecha62);
    
$hora   substr($fecha82);
    
$minuto substr($fecha102);
    
    return array(
      
'ano' => $ano,
      
'mes' => $mes,
      
'dia' => $dia,
      
'hora' => $hora,
      
'minuto' => $minuto
    
);
}

function 
convertirMiFechaUnix($fecha)
{
    if (!
comprobarMiFecha($fecha))
    {
        return 
false;
    }
    
    
$datos datosMiFecha($fecha);
    
    return 
mktime($datos['hora'], $datos['minuto'], 0$datos['mes'], $datos['dia'], $datos['ano']);
}

$mifecha 200711221330;

print_r(getdate(convertirMiFechaUnix($mifecha)));