Table of Content
HAL Forum
function integer DaysInMonth (
Integer Year,Integer Month)
Description:
Returns number of days for a given month of the specified year
Parameters:
Year Specifies the year to use to calculate the day count
Month The month number.
external function Integer DaysInMonth(Integer,Integer);

procedure ChangeDatePeriod(Date td,var string StartDateStr, var string EndDateStr)
begin
  longint days;
  
  date sd,ed;

  days = DaysInMonth(td.Year,td.Month); // gets number of days in a give date
  
  sd = AddDay(td,-td.Day+1); // gets the first date of the month for a given date
  ed = AddDay(sd,days-1); // gets the last date of the month for a given date

  StartDateStr = DateToString(sd,"DD.MM.YYYY"); // converts date sd to string StartDateStr
  EndDateStr = DateToString(ed,"DD.MM.YYYY"); // converts date ed to string EndDateStr

return;
end;
Related topics:
««