Ver Mensaje Individual
  #5  
Antiguo 21-09-2005
adlfv adlfv is offline
Miembro
 
Registrado: may 2005
Posts: 39
Reputación: 0
adlfv Va por buen camino
Hola.

Creo recordar que para ese tipo de cosas viene bien DateUtils...

Yo me hice unas funciones hace tiempo a mano, pero creo que en DateUtils hay funciones para hacer eso, y más... De todas formas si no consigues, aquí te adjunto el código que hice...

Código:
 // Devuelve true sii F1 representa la misma fecha que F2
 function Iguales(F1, F2: TDate): Boolean;
 begin
   Result := (Abs(StrToInt(FormatDateTime('YYYY', F1)) - StrToInt(FormatDateTime('YYYY', F2))) = 0) and
 		    (Abs(StrToInt(FormatDateTime('M', F1)) - StrToInt(FormatDateTime('M', F2))) = 0) and
 		    (Abs(StrToInt(FormatDateTime('D', F1)) - StrToInt(FormatDateTime('D', F2))) = 0)
 end;
 
 // Devuelve true sii F1 representa una fecha mayor que la fecha F2
 function Mayor(F1, F2: TDate): Boolean;
 begin
   Result := (StrToInt(FormatDateTime('YYYY', F1)) - StrToInt(FormatDateTime('YYYY', F2)) > 0) or
 		    ((StrToInt(FormatDateTime('YYYY', F1)) - StrToInt(FormatDateTime('YYYY', F2)) = 0) and
 			 (DateToJuliana(F1) - DateToJuliana(F2) > 0));
 end;
 
 // Devuelve true sii F1 representa una fecha menor que la misma fecha F2
 function Menor(F1, F2: TDate): Boolean;
 begin
   Result := Mayor(F2, F1);
 end;
Espero que te sirva.

Un saludo...
Responder Con Cita