In my flow I need to shift my start date with a fixed value but my main issue here is that if there is a weekend or public holiday, the target date must shift considering also the added days.
For example if the target date is on Wednesday is ok but if is on Sunday I need to add two days (considering Saturday and Sundays) in order to have the new target date on Tuesday.
Would you please explain what it is you’re trying to accomplish, in detail?
What are the starting dates?
What is the fixed value you’d like to add?
You talk about start dates and target dates, but the table you just posted only has “Date”. Is this a start date? A target date? something else?
What is the meaning of the “Additional duration” column in the table in your last post? As far as I can tell, that’s not a KNIME duration format. What are the units?
my issue here is not related only with date and target date but how the target date&time is moving considering also the time element
It’s unclear to me what this means. You haven’t actually said what the issue is or how times are supposed to be considered. Your post first talks about shifting dates, but then your second post talks about including times. This is confusing.
Using this table, I want to see how the date is moving considering the 6th & 7th of january as holiday.
I’m not sure what this means. All the dates in the table are January 5, 2021 (or June 1, 2021). What exactly are you looking for?
It would be great if you could provide some explanatory example data as well as examples of the output you’re aiming for.
Hi @Reader91 , on top of the questions that @elsamuel has asked, how do you identify a holiday? Is there a table that would say which dates are holidays?
Holidays are usually not international. For example, even Thanks Giving in North America is not on the same day in the US and in Canada.
But in general, I agree with @elsamuel that the request/issue is not clear. There are some undefined business rules.
Along with the clarifications, you can also add some sample input data, and what the expected output would be so we can verify if we indeed understood what’s expected.
first thank you for your response.
Below you will find a small tab with explanation because I realized I’ve been a bit imprecise in my description
What are the starting dates?
The date you will find is the start date&time that I would like to move
What is the fixed value you’d like to add?
I’ve forgot to say that I don’t have anymore a fixed value to be added to the start date but I would like to use the column that not correctly I’ve called Additional duration (now called Additional working days)
This column represent the additional working days&hours (formatted as double number) to be added to the start date&time.
It is important to highlight that the working time within the days is 9 to 17 (8 hrs)
My idea is to build a flow that is similar to this one
But instead of consider the shift based only on the working date I would like to put inside also the variable related to the working time
ID
Start date
Additional working days
Target date
54
2021-01-05T16:25
0.5
2021-01-07T12:25
157
2021-01-12T09:20
5.0
2021-01-19T09:20
169
2021-01-11T12:30
3.5
2021-01-14T16:30
For example the first row (ID 54) is shifting an additional date because adding 0.5 working days (4 working hrs) to the start date the potential target date would be on 2021-01-06 at 12:25 but considering that day is public holiday, is shifting to the 7th of january.
The second row ( ID 157) is shifting two additional days (on top of the 5 additional working days->40 working hrs) because we have saturday and sunday.
The third row is ok because the 14th of january is thursday and the target time is between the working hours (3.5 working days->28 working hours)
have you had any success with your task? This indeed seems a bit tricky as you have both working hours and non working days. Also I have seen you have entries before 9 and after 17 so it’s not clear how to approach to these entries. Is 18h + 1h => 10h or 11h?
Anyways one approach could be to separate column Additional working days into column with only days where you can then first use approach from above linked workflow, and column with hours, minutes and seconds (duration not larger than 8h) which you would then add to already shifted value to move it to next non working day. Does it make sense?