Odoo Help


How to extract the month from a date field?

Vale Trood
on 2/19/16, 5:52 AM 2,165 views

Hello everybody!!!!

Can anyone help me please.

I have this field type date:

2016-01-01 and i want to get the month then convert it to its name.

Need help friends please.

Best Regards.

Kalpana Hemnani
On 3/4/16, 7:38 AM

#import datetime library

from datetime import datetime

month = datetime.strptime('2016-01-01', "%Y-%m-%d").strftime('%B')#Converting a string format datetime into datetime() type.

You can use different directives as per your requirement in place of "%B". You can find them \here.

Best Regards,

Kalpana Hemnani


Hi Drees,

     you should use split method of python

i am consider date as year-month-date



if get_month=='1':


if you have such issues issues mail me on virzoteck@gmail.com

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: 2/19/16, 5:52 AM
Seen: 2165 times
Last updated: 3/4/16, 7:38 AM