Skip to Content
Menu
This question has been flagged
1 Reply
3463 Views

I'm developing a payroll module, and i need to calculate the quantity of mondays between two dates.

I'm Venezuela, there's a salary rule name "Social Security" and the formula is: (((Wage * 12) / 52) * 0.04) * quantity of mondays between dates.


Is there a way to calculates how many mondays are between two dates?

Avatar
Discard
Best Answer

Hi,

Try this:

mondays = 0
while date< date2:
     if date.weekday() == 0:
         mondays +=1

     date += relativedelta.relativedelta( days=+1)

Best regards

Avatar
Discard
Related Posts Replies Views Activity
1
May 25
720
1
Mar 25
954
0
Feb 25
1131
1
Dec 24
1668
0
Nov 24
108