返回指定日期的所在月的最后一天的日期:
function LastDayOfMonth(Dat: TDate): TDate;
var
D, M, Y : Word;
begin
DecodeDate(IncMonth(Dat, 1), Y, M, D);
Result := EncodeDate(Y, M, 1) - 1;
end;
function StartOfTheYear(const AValue: TDateTime): TDateTime;
function EndOfTheYear(const AValue: TDateTime): TDateTime;
function StartOfAYear(const AYear: Word): TDateTime;
function EndOfAYear(const AYear: Word): TDateTime;
function StartOfTheMonth(const AValue: TDateTime): TDateTime;
function EndOfTheMonth(const AValue: TDateTime): TDateTime;
function StartOfAMonth(const AYear, AMonth: Word): TDateTime;
function EndOfAMonth(const AYear, AMonth: Word): TDateTime;
function StartOfTheWeek(const AValue: TDateTime): TDateTime
{ISO 8601}
function EndOfTheWeek(const AValue: TDateTime): TDateTime
{ISO 8601}
function StartOfAWeek(const AYear, AWeekOfYear: Word
{ISO 8601}
const ADayOfWeek: Word = 1): TDateTime;
function EndOfAWeek(const AYear, AWeekOfYear: Word
{ISO 8601}
const ADayOfWeek: Word = 7): TDateTime;
function StartOfTheDay(const AValue: TDateTime): TDateTime;
function EndOfTheDay(const AValue: TDateTime): TDateTime;
function StartOfADay(const AYear, AMonth, ADay: Word): TDateTime
overload;
function EndOfADay(const AYear, AMonth, ADay: Word): TDateTime
overload;
function StartOfADay(const AYear, ADayOfYear: Word): TDateTime
overload;
function EndOfADay(const AYear, ADayOfYear: Word): TDateTime
overload;