function TForm1.IsFirstDay(aDay: string): boolean;
var
IncDate: TDate;
Day: string;
Today: TDate;
begin
Today := Date;
IncDate := StrToDate('01/'+FormatDateTime('mm', Today)+'/'+FormatDateTime('yyyy', Today));
try
//get first day of month that matches aDay
repeat
Day := FormatDateTime('dddd', IncDate);
IncDate := IncDate+1;
if FormatDateTime('mm', IncDate) <> FormatDateTime('mm', Today) then
raise Exception.Create('');
until Day = aDay;
IncDate := IncDate-1;
//is that day today?
Result := (IncDate = Date);
except
Result := False;
MessageDlg('End of month found without finding a match for the day!', mtError, [mbOK], 0);
end;
end;