Tema: Algoritmo!!!
Ver Mensaje Individual
  #7  
Antiguo 18-06-2007
Avatar de roman
roman roman is offline
Moderador
 
Registrado: may 2003
Ubicación: Ciudad de México
Posts: 20.269
Reputación: 10
roman Es un diamante en brutoroman Es un diamante en brutoroman Es un diamante en bruto
Prueba con esta función:

Código Delphi [-]
function EsFechaValida(S: String): Boolean;
var
  Y, M, D: Word;
  Fecha: TDateTime;

begin
  Y := StrToIntDef(Copy(S, 1, 2), 0);
  M := StrToIntDef(Copy(S, 3, 2), 0);
  D := StrToIntDef(Copy(S, 5, 2), 0);

  if Y*M*D > 0 then
    Result := TryEncodeDate(Y + 1900, M, D, Fecha)
  else
    Result := false;
end;

Y por cierto, trata de dar títulos más descriptivos para tus mensajes.

// Saludos
Responder Con Cita