| IsWorkingDay Function |
Unit
QESBPCSDateTime
Declaration
Function IsWorkingDay(const DT: TDateTime): Boolean;
Description
It is not a Working Day if the Day of Week lies in NonWorkingDays and if ESBUseChristianHolidays is set to True and the Date is Easter Sunday, Good Friday, Christmas Day. Easter Saturday & Easter Monday can also be made non-working by setting ESBUseEasterSaturday & ESBUseEasterMonday to true.
| Parameters |
| DT | Date to process. |
Category
Date/Time Comparison
Date/Time Arithmetic RoutinesImplementation
function IsWorkingDay (const DT: TDateTime): Boolean;
var
DOW: Byte;
Easter: TDateTime;
begin
Result := True;
DOW := DayOfWeek (DT);
if DOW in NonWorkingDays then
Result := False
else
begin
if ESBUseChristianHolidays then
begin
Easter := GetEasterSunday (DT);
if SameDate (Easter, DT) or SameDate (Easter - 2, DT) then
Result := False
else if ESBUseEasterSaturday and SameDate (Easter - 1, DT) then
Result := False
else if ESBUseEasterMonday and SameDate (Easter + 1, DT) then
Result := False
else if SameDate (GetChristmasDay (DT), DT) then
Result := False
end;
end;
End; |
|
|