I have from a database reader with two dates. How can I count weekdays between the two dates?
Hi,
I would first make a list of all days between the two days. Than extract the day of week, filter all Saturdays and Sundays and finally count the remaining using a groupby node.
Let me know if this works for you.
Best, Iris
I finally decided the easiest way to do this is in the SQL statement of the Database Reader.
For Instance in MySQL:
(DATEDIFF(dd, startdate, enddate + 1)
-(DATEDIFF(wk, startdate, enddate) * 2)
-(CASE WHEN DATENAME(dw, startdate) = 'Sunday' THEN 1 ELSE 0 END)
-(CASE WHEN DATENAME(dw, enddate) = 'Saturday' THEN 1 ELSE 0 END) as ORD_AGE,