Administrative Professionals Day - Wednesday of the Last Full Week of April
Here is a simple Delphi function that takes a year as its input and returns the date for
Administrative Professionals Day (Wednesday of the last full week of April), a day that is meant to recognize and honor all the wonderful administrative professionals who keep offices and businesses running every day. If you happen to have one or more in your office/business, mark your calendar and do something nice for them on this day. For additional Delphi code to return key dates, see
Delphi Code To Return Holidays, Observances, Celebrations, Historical, and Other Key Dates.
function AdministrativeProfessionalsDay(TargetYear: Integer): TDate;
var
FridayCount: Integer;
TargetDate: TDate;
begin
AdministrativeProfessionalsDay := 0;
FridayCount := 0;
TargetDate := 0;
TargetDate := StrToDate('4/30/'+IntToStr(TargetYear));
FridayCount := 0;
If DayOfTheWeek(TargetDate) = 5 then FridayCount := 1; //5 = Friday
If FridayCount = 0 then
begin
repeat
TargetDate := TargetDate - 1;
If DayOfTheWeek(TargetDate) = 5 then FridayCount := FridayCount + 1;
until FridayCount = 1;
end;
AdministrativeProfessionalsDay := TargetDate - 2;
end;
The procedure below uses the function shown above to retrieve Labor Day for a range of years. The FormatDateTime function can be used to format the date in any way desired.
procedure TForm1.Button1Click(Sender: TObject);
var
Year: Integer;
begin
For Year := 2000 to 2100 do
begin
Memo1.Lines.Add(FormatDateTime('dddd, mmmm d, yyyy', AdministrativeProfessionalsDay(Year)));
end;
end;
Posted: Monday, December 2, 2024