Ver Mensaje Individual
  #4  
Antiguo 06-03-2008
keyboy keyboy is offline
Miembro
 
Registrado: oct 2004
Posts: 367
Reputación: 20
keyboy Va por buen camino
Al contrario. Es mucho más difícil. Tanto DaysInAMonth como EncodeDate hacen uso del arreglo

Código Delphi [-]
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));

y la función IsLeapYear. Pero, mientras que DaysInAMonth simplemente "toma" el valor del arreglo:

Código Delphi [-]
Result := MonthDays[(AMonth = 2) and IsLeapYear(AYear), AMonth];

EncodeDate hace esto junto con varios condicionales y un ciclo for.

Bye
Responder Con Cita