# Excluding Saturdays and Sundays

Hello,
In a workflow for order planning, I calculate a production date from a delivery date (received by the customer) via Date & Time Shift Node:
Manufacturing date = delivery date - 3 days.

Saturdays and Sundays are also included, which I would like to exclude (no working days).

Example:
Delivery date = 22.06.2021
Manufacturing date = 22.06. - 3 days = 19.06.2021 (Saturday)

The next day of the week would then have to be set via a condition, in this example it would be 06/18/2021 (Friday).

Is that possible and if so, how?

Maybe this How get working day without weekend - #5 by Banksy may give some answer to your question

1 Like

Hi USCHUKN1ME,

Iâ€™ve whipped something up real quick and I hope it gets close to what you are aiming at. Workflow attached, hereâ€™s what Iâ€™ve done:

1. Created dates as provisionary manufacturing dates, named the column â€śdateâ€ť
2. Appended column with manufacturing date shifted +3d, named it â€śdate_deliveryâ€ť
3. Extracted day of week of â€śdate_deliveryâ€ť
4. Rule Engine: if day of week = 6 => -1, if day of week = 7 => -2, else 0
5. Shifted â€śdateâ€ť by number of days from Rule Engine. Saturdays and Sundays become the previous Friday, named this new column â€śdate_manufacturingâ€ť

temp-33788.knwf (17.1 KB)

The last two nodes are optional. If you donâ€™t have any deliveries on Sunday, you could exclude the 7s from the day of week column before the Rule Engine. I only noticed afterwards and couldnâ€™t be bothered to change the order of nodes again. I think you get the idea. The resulting table could then be joined with the table containing the dates you use.

1 Like

If you can then use Extract Date Time Fields node like @G47_2 pointed out.
If not I would use a code snippet node

thank you very much - it helps me a lot .

Iâ€™ve integrated the wokflow, adjusted it a bit. Everythingâ€™s working perfectly.

Thx !!!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.