[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] |
Increases the month in a TDateTime value with a given amount.
Source position: datih.inc line 121
function IncMonth( |
const DateTime: TDateTime; |
NumberOfMonths: Integer = 1 |
):TDateTime; |
IncMonth increases the month number in DateTime with NumberOfMonths. It wraps the result as to get a month between 1 and 12, and updates the year accordingly. NumberOfMonths can be negative, and can be larger than 12 (in absolute value).
None.
|
Return the current date. |
|
|
Returns the current time. |
|
|
Returns the current date and time. |
Program Example15; { This program demonstrates the IncMonth function } Uses sysutils; Var ThisDay : TDateTime; Begin ThisDay:=Date; Writeln ('ThisDay : ',DateToStr(ThisDay)); Writeln ('6 months ago :',DateToStr(IncMonth(ThisDay,-6))); Writeln ('6 months from now :' ,DateToStr(IncMonth(ThisDay,6))); Writeln ('12 months ago :',DateToStr(IncMonth(ThisDay,-12))); Writeln ('12 months from now :' ,DateToStr(IncMonth(ThisDay,12))); Writeln ('18 months ago :',DateToStr(IncMonth(ThisDay,-18))); Writeln ('18 months from now :' ,DateToStr(IncMonth(ThisDay,18))); End.
lazarus-ccr.sourceforge.net |