maybe this solution, there are actually three for cross verification, are of interest for you. Approach used:
Pure mathematical: Given that each week has seven days you can subtract these from the total amount of days in between dates. The edge case for less than seven days but where a Sunday is still included (Start: Saturday; End: Monday) must be factored in.
Loop wise approach: Loop over each row and loop per days diff between dates to shift the date based on the iteration. Determine the day of the week for the result. Then do a simple filtering of all Sundays and count via GroupBy the remaining days.
Similar to #2 but Count occurrence of days per day of week for each start and end date. Then sum Mon-Sat.
I used Chat GPT to calculate some random dates and their respective count of days w/o Sundays.
I really apreciatte all your effort and solutions, also I didn´t express my self properly, so I apologize for that.
The thing I need is to compare dCol1 with dCol2 and substract 24H or 1 day if there´s a Sunday in that time range.
date1
date2
duration
25/04/2024
29/04/2024
3
27/04/2024
29/04/2024
1
26/04/2024
30/04/2024
3
Also I´m trying some ideas I get from your solutions, like using loops, of javaSnippet, but I haven´t found the trick again, I apreciate your time.
Happy weekend
@ttsk8der you can use the workflow I provided and either remove 1 day for each Sunday or just one if a Sunday is within that date range. Give it try yourself, you’ve got everything you need
So I´m following your WK step by step but I got an issue in the first step, so the next ones are a complete mess.
Extracting fields from “Extract Date&Time Fields”. Data is does not make sense, for example.
I have the following sample.
D1
D2
weekDay
numberDay
22-01-2024
22-01-2024
2
Monday
18-01-2024
19-01-2024
5
Thursday
26-01-2024
30-01-2024
6
Friday
The matter here is that, numberWeek appears with one extra number, don´t know if there´s a trouble ocasionated by the previous data process, or if it´s caused by the data type (Date & Time).
I tried to substract the aditional 1 by Math formula or Rule engine, but any code worked, it just appended a column with -1 Value. I also would appreciate if you can share me the right process or code to solve this issue.
Sure, let me show you the WK and some sample data, also allow me to reformulate my case. Context: Those are some of the date where my partners did some company process, the problem is, inputs are a mess because the hours are very random. I need to organize the time the process took in laboral hours, which mean that duration outputs should´nt count hours outside or sundays.
I was hoping to do it with some examples but I got more confuse so, I apologize for that.
Awesome, thanks! Is my assumption correct that each row represents one experiment and thus the date&time stamps of each row should not get separated from each other?
Every row is the moment when some process was made.
I´m doing it w/o separate the time stamps form the dates, but there´s no problem if you need to separate it
Thanks for your time and efforts, honestly you gave me some ideas, like substract previous duration.
But honestly I got lost, specially because in my dataset when I´m trying to “Extract Date&Time fields” I got error on the fields with local time. Let me give you an example.
If I select “Locale configuration” in english I got the right week number for the rigth day name , as we can see here:
But if I select any “Locale configuration” in spanish (Have to make my WK in that language) I got the wrong week number for the rigth day name.
With this configuration I´m getting “Jueves (Thursday)” as 5 (Friday), or “Lunes (Monday)” as 2 (Tuesday).
Don´t know if this is a node bug or some issue ocasionated by previous processing .