Odoo Help


How to get date max in next month?

on 1/12/15, 8:42 AM 888 views

If we will take date max in this month, can use this code :


date_now = datetime.today()
date_max = date_now.max.day


But how to take date max in next month?


Atchuthan - Technical Consultant, Sodexis Inc

--Atchuthan - Technical Consultant, Sodexis Inc--
Atchuthan - Technical Consultant, Sodexis Inc
| 5 3 8
Puducherry, India
--Atchuthan - Technical Consultant, Sodexis Inc--
Passionate coder in Python/Odoo(formerly known as OpenERP).

Contact me via GMail: atchuthantu@gmail.com via Skype: atchuthan_skype
via Linkedin: http://in.linkedin.com/in/atchuthantu
Atchuthan - Technical Consultant, Sodexis Inc
On 1/12/15, 8:58 AM

Try this,

from dateutil.relativedelta import relativedelta
from datetime import datetime
next_month = datetime.today() + relativedelta(months=1)



| 5 4 6
Zagreb | Karlovac, Croatia

there is only 10 kind of people the ones that understand binary ... and others

On 1/12/15, 8:50 AM

import calendar
date_now = datetime.today()
day_max = calendar.monthrange(date_now.year, date_now.month +1 )[1]  # return tuple( 1.st day, number of days)

hope it helps

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

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 E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 1/12/15, 8:42 AM
Seen: 888 times
Last updated: 7/10/15, 10:50 AM