Days in month

, \t\t , This article demonstrates how to detect how many days there are in a given month.,,procedure TForm1.Button1Click(Sender: TObject);,, var,, MyDate : TDateTime;,, tmpStr : String;,, tmpInt : Integer;,, begin,, MyDate := Date() + 365 - (30*5);,, tmpStr := FormatDateTime('mmmm yyyy',MyDate);,, tmpInt := DaysInMonth(MyDate);,, ShowMessage(tmpStr + ' has ' + IntToStr(tmpInt) + ' days...');,, end;,,, function TForm1.DaysInMonth(ADate:TDateTime):Integer;,, var,, MyMonth,,, MyYear,,, MyDay : Word;,, MyDayTable : TDayTable;,, tmpBool : Boolean;,, begin,, DecodeDate(ADate, MyYear, MyMonth, MyDay);,, tmpBool := IsLeapYear(MyYear);,, MyDayTable := MonthDays[tmpBool]; ,,, resultat: = mydaytable [mymonth],,,,,



Previous:
Next Page: