Odoo Help

Welcome!

This community 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.

0

get month from field

By
omar bahri
on 8/6/16, 6:40 AM 274 views

i have a model using fields that has date type, i try to get month from date but i can't

0

Sudhir Arya (SA)

--Sudhir Arya (SA)--
10150
| 6 8 8
Ahmedabad, India
--Sudhir Arya (SA)--

Working as an OpenERP/Odoo developer and a Team Leader 

Top 5 Odoo contributor On Stackoverflow

LinkedIn

Blog

Stackoverflow

Sudhir Arya (SA)
On 8/7/16, 12:08 PM

You just have to use python datetime library.

Ex:

from datetime import datetime
# Get month from your date
datetime.strftime(datetime.strptime(your_date_field, "%Y-%m-%d"), %m)

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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 8/6/16, 6:40 AM
Seen: 274 times
Last updated: 8/7/16, 12:08 PM