# calculate date difference excluding holidays/weekends

**URL:** <https://forum.knime.com/t/calculate-date-difference-excluding-holidays-weekends/3761>\
**Category:** KNIME Analytics Platform\
**Created:** [June 8, 2016, 3:12pm UTC](https://forum.knime.com/t/calculate-date-difference-excluding-holidays-weekends/3761 "2016-06-08T15:12:31Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tatiana](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/t/e79b87/32.png) [@Tatiana](https://forum.knime.com/u/Tatiana)\
**Post date:** [June 8, 2016, 3:12pm UTC](https://forum.knime.com/t/calculate-date-difference-excluding-holidays-weekends/3761/1 "2016-06-08T15:12:31Z")

</div>

Hi all,

I am looking for the function in KNIME &nbsp;doing the same as "networkdays()" in Excel. Basicaly I want to be able to exclusde certain dates(provided as a list) from the Time Difference calculation.

Is there already such an option in KNIME, or could you advise on strategy to do it?&nbsp;

---

<div class="post-metadata">

**Author:** ![johnm](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/j/848f3c/32.png) [@johnm](https://forum.knime.com/u/johnm)\
**Post date:** [June 9, 2016, 6:48pm UTC](https://forum.knime.com/t/calculate-date-difference-excluding-holidays-weekends/3761/2 "2016-06-09T18:48:21Z")

</div>

I was looking for&nbsp;similar&nbsp;functionality recently - wanted to exclude weekend days from a time difference.&nbsp;I couldn't find a way to do it with existing nodes, so eventually used a java snippet.

It would be great if this functionality could be added to the Time Difference node - eg add 'Weekday' as a new granularity of time difference - or allow users to exlude specific days/dates from the calculation?

Cheers,

&nbsp; &nbsp; &nbsp; &nbsp; johnm.

---

<div class="post-metadata">

**Author:** ![Tatiana](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/t/e79b87/32.png) [@Tatiana](https://forum.knime.com/u/Tatiana)\
**Post date:** [June 10, 2016, 2:48pm UTC](https://forum.knime.com/t/calculate-date-difference-excluding-holidays-weekends/3761/3 "2016-06-10T14:48:06Z")

</div>

Hi Johnm,

finally I also made a metanode with R-script, that uses a separate list of days to exclude. &nbsp;&nbsp;I agree with you - such option&nbsp;would &nbsp;seem a nice addition to the timedifference node.

P.S. For people landing here after googling for the similar thing &nbsp;- if there is still no standart solution and&nbsp;you do&nbsp;not want to code it, I attached mine.&nbsp;I beleeve it works fine, no guarantee though&nbsp;

Best,&nbsp;

Tatiana.

&nbsp;

- [knime\_getnetworkdays.zip](https://www.knime.com/sites/default/files/knime_getnetworkdays.zip)

---

<div class="post-metadata">

**Author:** ![Iris](https://forum-cdn.knime.com/user_avatar/forum.knime.com/iris/32/14_2.png) [@Iris](https://forum.knime.com/u/Iris)\
**Post date:** [June 13, 2016, 9:13pm UTC](https://forum.knime.com/t/calculate-date-difference-excluding-holidays-weekends/3761/4 "2016-06-13T21:13:16Z")

</div>

I just opened a feature request for this one.

Cheers, Iris

---

<div class="post-metadata">

**Author:** ![Hajji](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/h/f04885/32.png) [@Hajji](https://forum.knime.com/u/Hajji)\
**Post date:** [February 1, 2017, 8:06am UTC](https://forum.knime.com/t/calculate-date-difference-excluding-holidays-weekends/3761/5 "2017-02-01T08:06:36Z")

</div>

Hi Tatiana,

Thanks for this file, however, I don't know how to get the file named Holidays.txt so I can replicate our holidays.

Regards,

&nbsp;

Hajji

---

<div class="post-metadata">

**Author:** ![Tatiana](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/t/e79b87/32.png) [@Tatiana](https://forum.knime.com/u/Tatiana)\
**Post date:** [March 8, 2017, 11:16am UTC](https://forum.knime.com/t/calculate-date-difference-excluding-holidays-weekends/3761/6 "2017-03-08T11:16:33Z")

</div>

Hi Iris,

was there any progress on this issue?&nbsp;

Would be lovely to be able to supply a list of dates to be excluded from the calculation, sort of like in reference filter.&nbsp;

Best, Tatiana.

---

<div class="post-metadata">

**Author:** ![jogayon001](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/j/8491ac/32.png) [@jogayon001](https://forum.knime.com/u/jogayon001)\
**Post date:** [January 28, 2019, 3:58am UTC](https://forum.knime.com/t/calculate-date-difference-excluding-holidays-weekends/3761/7 "2019-01-28T03:58:06Z")

</div>

Hi Everyone, has this concern already been resolved?

Hi Tatiana, could you possible post the workflow you made to solve this issue? For some reason  
I can not download open the workflow file you appended.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [January 28, 2019, 7:24am UTC](https://forum.knime.com/t/calculate-date-difference-excluding-holidays-weekends/3761/8 "2019-01-28T07:24:00Z")

</div>

We had such a discussion and I built a workflow using a public database of holidays maybe you can adapt that. Of course you would have to check what the holidays mean for your purpose.

I could try to see if I can use the workflow above.

> [@Dividing and splitting rows](https://forum.knime.com/t/dividing-and-splitting-rows/11381/5):
>
> I constructed a workflow that illustrates how you could do it. Basically you first do it like in the example above you count down from the original TargetDay the you expand the possible TargetDays by factor 3 (so you will have enough days once you start eliminating some in-between) then you mark all days that are not suitable like holidays and weekends the remaining ones you just join back by an iteration number and voila you have the new TargetDays the yellow marked columns state why …

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [June 23, 2023, 8:19pm UTC](https://forum.knime.com/t/calculate-date-difference-excluding-holidays-weekends/3761/9 "2023-06-23T20:19:36Z")

</div>


