Description |
The EndOfAMonth function generates a TDateTime value set to the given Year and Month with the day set to the last of the month, and the time set to 1 milli-second before midnight.
The Year value must be between 0 and 9999.
The Month value must be between 1 (January) and 12 (December).
|
| Notes | Errors in the parameter values gives EConvertError.
| | Related commands | EndOfADay | | Generate a TDateTime value set to the very end of a day |
|
Download this web site as a Windows program.
|
|
|
|
Example code : Set the date to the last millisecond of February 2000, a leap month | var
mydate : TDateTime;
begin
myDate := EndOfAMonth(2000, 2);
 // Ensure that milli-seconds are shown
LongTimeFormat := 'hh:mm:ss.zzz';
ShowMessage('End of February 2000 = '+DateTimeToStr(myDate));
end;
| Show full unit code | End of February 2000 = 29/02/2000 23:59:59.999 |
|
|