Programming C# C++ (7) Delphi (617) .NET (2) Database (71) Delphi IDE (89) Network (39) Printing (3) Strings (12) VCL (83) Windows with Delphi (280) Java (8) JavaScript (31) perl (9) php (4) VBScript (1) Visual Basic (1)
Exchange Links About this site Links to us 
|
Incrementing a date
This article has not been rated yet. After reading, feel free to leave comments and rate it.
Sometimes you may need to increment a date by one month.
Simply adding 30 days won't do the trick, since some months do have 31 days.. not to forget the issue with leap years.
But there is a simple solution in SysUtils.pas: this unit provides a routine IncMonth().
Use it as in the following snippet:
 | |  | | var
OldDate,
NewDate : TDateTime;
begin
OldDate := ..
NewDate := IncMonth (OldDate, 1);
end; | |  | |  |
Comments:
|