ACF Library

AdjustWorkAndSaturays

Back to List

Description: Adjust a given date to the next working day if Sunday

FileMaker Prototype:

Set Variable [$res; ACF_Run("AdjustWorkAndSaturays"; date_current)]

Category: EXCEL

Function source:

// Adjust a given date to the next working day if Sunday
function AdjustWorkAndSaturays(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 Sunday (7), move to the next Monday
    if (dow > 6) then 
        current = current + 1; // Move forward one day to Monday
    end if

    // Return the adjusted date
    return current; 
end

Back to List