Odoo Help


1 Answer

Ghanshyam Prajapati

--Ghanshyam Prajapati--

| 4 4 10
Pune, India
--Ghanshyam Prajapati--
OpenERP Developer
Ghanshyam Prajapati
21/3/14 08:24

Hi Sneha,

Try this,

from datetime import datetime
date_format = "%m/%d/%Y"
a = datetime.strptime('8/18/2008', date_format)
b = datetime.strptime('9/26/2008', date_format)
delta = b - a
print delta.days # that's it

See following link

Hope it works for you

sneha antony
21/3/14 08:54

Where to give this code?What if the date is not specified as 8/18/2008 and 9/26/2008

Ghanshyam Prajapati
21/3/14 09:34

suppose your date format is '2014-12-31', for that your date_format will be '%Y-%m-%d'

sneha antony
24/3/14 05:18

This is to be added in the .py file right?

sneha antony
24/3/14 05:21

Which names are to be given instead of 8/18/2008 and 9/26/2008 in my code?

Ask a Question
Keep Informed
0 follower(s)
About This Community

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 eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now