Ano bissexto
Como faço para descobrir se um ano é bissexto??
Pra q serve a função IsLeapYear?
Pra q serve a função IsLeapYear?
Thaleshcv
Curtidas 0
Respostas
Falcao
24/06/2004
function AnoBis(Data: TDateTime): Boolean;
{Testa se um ano é bixesto, retornando True em caso positivo}
var
Dia,Mes,Ano : Word;
begin
DecodeDate(Data,Ano,Mes,Dia);
if Ano mod 4 <> 0 then
begin
AnoBis := False;
end
else if Ano mod 100 <> 0 then
begin
AnoBis := True;
end
else if Ano mod 400 <> 0 then
begin
AnoBis := False;
end
else
begin
AnoBis := True;
end;
end;
{Testa se um ano é bixesto, retornando True em caso positivo}
var
Dia,Mes,Ano : Word;
begin
DecodeDate(Data,Ano,Mes,Dia);
if Ano mod 4 <> 0 then
begin
AnoBis := False;
end
else if Ano mod 100 <> 0 then
begin
AnoBis := True;
end
else if Ano mod 400 <> 0 then
begin
AnoBis := False;
end
else
begin
AnoBis := True;
end;
end;
GOSTEI 0
Khundalini
24/06/2004
A função IsLeapYear() serve justamente para indicar se um determinado ano é bissexto ou não.
[]s
Rubem Rocha
Manaus, AM
[]s
Rubem Rocha
Manaus, AM
GOSTEI 0