morfeo21
21-01-2005, 18:13:39
Que tal foro. Una pregutita , si me pueden ayudar .Deseo crear una funcion que al yo darle el mes y el año me devuelva el ultimo dia del mes indicado.
agradesco de antemano su ayuda . :p
Héctor Randolph
21-01-2005, 18:30:21
Hola Morfeo!
Hay una función en Delphi que te devuelve los días que hay en cada mes y está implementada de la siguiente forma:
{ 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;
La encuentras en la unidad Dateutils.pas
Un Saludo.
morfeo21
21-01-2005, 19:06:18
Gracias Hector .El dato que me diste soluciono mi problema.
vBulletin v3.6.8, Derechos ©2000-2024, Jelsoft Enterprises Ltd.