Ver Mensaje Individual
  #8  
Antiguo 26-10-2005
Avatar de Héctor Randolph
[Héctor Randolph] Héctor Randolph is offline
Miembro Premium
 
Registrado: dic 2004
Posts: 882
Reputación: 20
Héctor Randolph Va por buen camino
Es extraño que no tengas la unidad DateUtils , busca en la ruta
{Delphi5 Dir}\Source\Rtl\Common por algún lado debería estar.

Si no la encuentras aquí transcribo la función DaysInAMonth para que la implementes.

Código Delphi [-]

{ The MonthDays array can be used to quickly find the number of
  days in a month:  MonthDays[IsLeapYear(Y), M]      }

const
  MonthDays: array [Boolean] of TDayTable =
    ((31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31),
     (31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31));

function DaysInAMonth(const AYear, AMonth: Word): Word;
begin
  Result := MonthDays[(AMonth = 2) and IsLeapYear(AYear), AMonth];
end;

function IsLeapYear(Year: Word): Boolean;
begin
  Result := (Year mod 4 = 0) and ((Year mod 100 <> 0) or (Year mod 400 = 0));
end;

Un saludo.
Responder Con Cita