Thema: Delphi Anzahl Tage im Monat

Einzelnen Beitrag anzeigen

IIIMADDINIII
(Gast)

n/a Beiträge
 
#19

Re: Anzahl Tage im Monat

  Alt 14. Mär 2009, 11:07
dann fügt man das einfach mit hinzu
Delphi-Quellcode:
function TForm1.getdaysinmonth(date: TDATETIME): integer;
const
   monthday: array[1..12] of integer = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
begin
if strtoint(formatdatetime('m', date)) <> 2 then
begin
  result := monthday[strtoint(formatdatetime('m', date))];
end
else
begin
  if (round(strtoint(formatdatetime('yyyy', date)) / 4) = strtoint(formatdatetime('yyyy', date)) / 4) and not(round(strtoint(formatdatetime('yyyy', date)) / 400) = strtoint(formatdatetime('yyyy', date)) / 400) then result := 29
  else result := 28;
end;
end;
wo ist das problem??
  Mit Zitat antworten Zitat