Checking non-working day in Business Central27-08-2023 |
It is quite often we need to check whether the day is a non-working or not. The below method can be used for checking the same. Business Central Version : 21 procedure DateIsNonWorking(CheckDate: Date): Boolean var CompanyInformation: Record "Company Information"; CustomizedCalendarChange: Record "Customized Calendar Change"; CalendarManagement: Codeunit "Calendar Management"; begin CompanyInformation.get(); CalendarManagement.SetSource(CompanyInformation, CustomizedCalendarChange); if CalendarManagement.IsNonworkingDay(CheckDate, CustomizedCalendarChange) then exit(true) else exit(false); end; |