Skip to Content
Menu
This question has been flagged
1 Reply
2998 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
Dec 24
397
0
Nov 24
107
1
Jul 24
4042
2
Jun 24
3469
1
Dec 23
449