Fórum Dias do Mês #166964
30/06/2003
0
Existe alguma função do Delphi para retornar o número de dias de um mês (28,29,30 ou 31).
Grato
Grato
Cfreitas
Curtir tópico
+ 0
Responder
Posts
30/06/2003
Leanribas
vc pode fazer uma função assim:
function DaysPerMonth(AYear, AMonth: Integer): Integer;
const
DaysInMonth: array[1..12] of Integer =
(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
begin
Result := DaysInMonth[AMonth];
if (AMonth = 2) and IsLeapYear(AYear) then Inc(Result);
end;
Falou.
function DaysPerMonth(AYear, AMonth: Integer): Integer;
const
DaysInMonth: array[1..12] of Integer =
(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
begin
Result := DaysInMonth[AMonth];
if (AMonth = 2) and IsLeapYear(AYear) then Inc(Result);
end;
Falou.
Responder
Gostei + 0
30/06/2003
Ivanh
No Delphi 7, não sei se existe em versões anteriores...
DaysInMonth(Now);
DaysInMonth(Now);
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)