AdjustWorkDays
Back to ListDescription: Adjust a given date to the next working day (Monday-Friday)
FileMaker Prototype:
Set Variable [$res; ACF_Run("AdjustWorkDays"; date_current)]
Category: EXCEL
Function source:
// Adjust a given date to the next working day (Monday-Friday)
function AdjustWorkDays(date current)
// Determine the day of the week (1 = Monday, ..., 7 = Sunday)
int dow = string(current, "%w");
dow = ((dow == 0) ? 7 : dow); // Convert Sunday (0) to 7 for easier comparison.
// If the day is Saturday (6) or Sunday (7), move to the next Monday
if (dow > 5) then
current = current + (8 - dow); // Calculate days to next Monday
end if
// Return the adjusted date
return current;
end
