Thema: Delphi Anzahl Tage im Monat

Einzelnen Beitrag anzeigen

IIIMADDINIII
(Gast)

n/a Beiträge
 
#15

Re: Anzahl Tage im Monat

  Alt 14. Mär 2009, 10:59
sonst dieses script hätte auch funkitioniert
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 then result := 29
  else result := 28;
end;
end;
  Mit Zitat antworten Zitat