Skip to Content
Menu
This question has been flagged
1 Odpoveď
3494 Zobrazenia

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
Zrušiť
Best Answer

Hi,

Try this:

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

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

Best regards

Avatar
Zrušiť
Related Posts Replies Zobrazenia Aktivita
1
máj 25
858
1
mar 25
1042
0
feb 25
1227
1
dec 24
1748
0
nov 24
108