Mega Code Archive

 
Categories / Delphi / Algorithm Math
 

How to know if a date is the last day of a month (for beginners)

Title: How to know if a date is the last day of a month? (for beginners) Question: How i can know if a date is the last day of the month? Answer: // returns TRUE if the date is the last day of the month. function IsLastMonthDay(const datDate: TDateTime): boolean; var intYear, intMonth, intDay: word; begin // decode the date in separated variables decodeDate ( Date + 1, intYear, intMonth, intDay ); result := intDay = 1; end;