From Clomosy Docs

Revision as of 06:35, 28 February 2023 by ClomosyManager (talk | contribs) (Created page with " function IncMonth(const StartDate TclDateTime {; NumberOfMonths Integer = 1}):TclDateTime; The IncMonth function returns a TclDateTime value with NumberOfMonths greater than the passed StartDate. The time component of the StartDate value is passed unchanged to the output value. The year value is incremented accordingly.<br> Increment value is optional, defaults to 1.<br> If the day value is too high for that month/year after the month is increased, it is reduced to...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

function IncMonth(const StartDate TclDateTime {; NumberOfMonths Integer = 1}):TclDateTime;

The IncMonth function returns a TclDateTime value with NumberOfMonths greater than the passed StartDate. The time component of the StartDate value is passed unchanged to the output value. The year value is incremented accordingly.

Increment value is optional, defaults to 1.

If the day value is too high for that month/year after the month is increased, it is reduced to the highest value for that month/year.

Example:

var
  dateValue : TclDateTime;
begin dateValue := StrToDate('28.02.2023'); ShowMessage('dateValue = '+DateToStr(dateValue));
dateValue := IncMonth(dateValue, 2); ShowMessage('dateValue + 2 months = '+DateToStr(dateValue)); end;

Output:

dateValue = 28.02.2023
dateValue + 2 months = 28.04.2023