Skip to content
Advertisement

SQL-Server I’m getting crazy with workday calculation with datepart

I’m working on SQL-Server 2012 and have the following code example to get workdays between two dates

the result is 4, which is correct…

But If I put 2019/02/24 (sunday) for the EndDate I’m getting 3… ????

I’m getting crazy here…

Advertisement

Answer

You’re validating your Enddate to be Sunday instead of Saturday. I had a similar function available that is independent of date settings.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement