Delphi returns the days of the current month according to the date

From , 4 Years ago, written in Delphi (Object Pascal), viewed 50 times.
URL https://pastebin.vip/view/1f418331
  1. function DaysInMonth(const ADateTime: TDateTime): Byte;
  2. const
  3.   cDaysPerMonth: array[1..12] of Byte =  // array of days in months
  4.     (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
  5.   cMonthFeb = 2;            // month number of February
  6.   cDaysInLeapYearFeb = 29;  // number of days in February in leap year
  7. var
  8.   Month: Word;  // month component of specified date
  9. begin
  10.   Month := DateMonth(ADateTime);
  11.   Result := cDaysPerMonth[Month];
  12.   if (Month = cMonthFeb) and IsLeapYear(ADateTime) then
  13.     Result := cDaysInLeapYearFeb;
  14. end;
  15. //delphi/2170

Reply to "Delphi returns the days of the current month according to the date"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website