If not, there are two options depending on how accurate you need to be.
If it doesn’t have to be 100% and the periods are relatively long, just multiply the difference by 5/7.
If you need accuracy, that means a very long if statement asking whether the period starts on a Monday, ends on a Monday; starts on a Tuesday ends on a Monday . . . . . .
It’s doable, as long as you don’t need to allow for holidays.