# how to determine how many mondays there between two dates

By
Giovanny Vizcaya
on 9/28/16, 10:56 PM 600 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?

#### Bejaoui Souheil

--Bejaoui Souheil--
1111
| 2 1 5
Rennes, France
--Bejaoui Souheil--

Odoo developer,  functional and technical consultant

souheil_bejaoui@hotmail.fr

Bejaoui Souheil
On 9/29/16, 4:02 AM

Hi,

Try this:

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

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

Best regards

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

### Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

1 follower(s)

### Stats

 Asked: 9/28/16, 10:56 PM Seen: 600 times Last updated: 9/29/16, 4:02 AM