通过IncMonth函数 例如 IncMonth(StrToDateTime('2003-07-17'),1)得到的是2003-08-17 IncMonth(StrToDateTime('2003-07-17'),7)得到的是2004-02-17函数原型为: IncMonth functionReturns a date shifted by a specified number of months.UnitSysUtilsCategorydate/time routinesfunction IncMonth(const Date: TDateTime; NumberOfMonths: Integer = 1): TDateTime;DescriptionIncMonth returns the value of the Date parameter, incremented by NumberOfMonths months. NumberOfMonths can be negative, to return a date N months previous.If the input day of month is greater than the last day of the resulting month, the day is set to the last day of the resulting month. The time of day specified by the Date parameter is copied to the result.
YourDate := IncMonth(Date, 7);
能够给我举个简单的例子吗?
例如
IncMonth(StrToDateTime('2003-07-17'),1)得到的是2003-08-17
IncMonth(StrToDateTime('2003-07-17'),7)得到的是2004-02-17函数原型为:
IncMonth functionReturns a date shifted by a specified number of months.UnitSysUtilsCategorydate/time routinesfunction IncMonth(const Date: TDateTime; NumberOfMonths: Integer = 1): TDateTime;DescriptionIncMonth returns the value of the Date parameter, incremented by NumberOfMonths months. NumberOfMonths can be negative, to return a date N months previous.If the input day of month is greater than the last day of the resulting month, the day is set to the last day of the resulting month. The time of day specified by the Date parameter is copied to the result.