Count Weekdays/Workdays

Hi Guys,

Would you know if there is a node that counts the weekdays between two dates? In Excel, this is as simple as networkdays functionality but I can't seem to find this in Knime.

Thanks,

Hi Hajjii,

no th this is not possible straightforward. The only solution would be to do something like Tatiana proposed here. However you would still need the list of public holidays.

https://tech.knime.org/forum/knime-users/calculate-date-difference-excluding-holidaysweekends

Best, Iris

Thanks Iris,

However, I don't have reference on how the format of the list will look like, would you know how to input it?

Hi Iris and Haji,

Has there been an development in this inquiry? I am looking for a networday functionality as well in knime and also tried Tatiana’s solution in the link provided by Iris above and I am getting a “inactive port object” error.

Thanks.

Hi there!

Your request have been noted. In the meantime I have constructed a workflow which counts number of working day, weekend days and holidays per month in 2018 and 2019 year. Holidays are read from external file and are applicable for Croatia.

Fell free to ask if there will be any questions.

2019_02_26_Number_of_Working_Days_in_Month.knwf (22.2 KB)

Br,
Ivan

1 Like

If the Python Integration is an option that can be used, numpy offers a very easy solution to that problem:

https://het.as.utexas.edu/HET/Software/Numpy/reference/generated/numpy.busday_count.html

1 Like

You could try to download the current holidays of a country from a site like Countries | Office Holidays.

I built a workflow doing that. It might useful if you want to take variable holidays like easter into account. Some holidays might only be local ones or might not be bank holidays. So you might have to come up with a rule. Or you could just write them into a list :slight_smile:

1 Like

Hi Iris,

Do you know if there’s any plans to develop this functionality, whether in a current node or to create a new node? There’s a handful of requests/questions about how to calculate weekdays between dates over the years, but only workarounds have been proposed, which aren’t always the most straight forward, simple, or obvious. It would be wonderful if the Date&Time Shift or Difference nodes could exclude specified dates, whether these be weekends, holidays, or even specific weekdays that a Knimer would like to exclude from their analysis.

Cheers,

Sclemente

Hello @sclemente,

agree it would be nice to have these kind of exlusion options in Date&Time Difference node. Also specific dates could be excluded if there is an option port to which you feed list of specific dates (e.g. Holidays and/or specific company non-working dates).

Anyways have added +1 to existing ticket. (Internal reference: AP-14411)

Br,
Ivan

3 Likes

Thank you so much, Ivan! I think a lot of Knimers will be excited for the introduction of this functionality!

It would be great if this functionality allowed users to exclude (or include) specific hours of a day, and not just exclude a whole day. I know that this level of granularity has been requested by other users (e.g., Date manipulation based on Non-working day).

For my workflow, I’m calculating energy consumption reduction achieved by participants during a Demand Response (DR) event. To do this, I need to calculate average energy consumption between specific hours during the prior 10 weekdays that exclude other DR events (specific weekdays that are important to me), weekends, and holidays.

1 Like