Loop until previous date is not weekends and holidays

Hi everyone,

I have some problem about defining previous date. I want to find previous date that not be weekends (Saturday and Sunday) and holidays. I need to reverse shift day until the previous date is correct. Such as

If current date is 24-Aug-2020 (Monday) and 21-Aug-2020 (Friday) is holiday. I need to reverse shift day until previous date is 20-Aug-2020.

How can I solve it?

Hi @atph_phi
Welcome to the Knime Community!

There are more people struggling with weekend days and holidays. This Forum search on holiday might give you some answers.

It depends a bit whether you need to have one e.g. variable containing the correct previous date in your workflow, or whether you have a table containing dates and apply this logic on a datecolumn, to get for all those dates the previous date.
If it’s just a single date to determine you might make a small snippet of java in a Java Edit Variable node.

If it’s something to be applied to a table containing a date column, you probably want to follow another approach.
The simple part in this is the weekend day. Although a weekend (or non-working day) is not the same in all countries, in a country it is the same every week.

The problem is the holiday. Holidays are different everywhere in the world (different between countries and sometimes even between regions). You would need to have a table or something to capture those dates which you recognize as holidays.

Maybe you can explain a bit more how this is to be incorporated in your workflow.


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