Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I have datetime field called field1 there i am selecting date & time and i have another field called filed2 there it should display only fields1's time. How can we do this?
As of now i am displaying both date and time. Unable to display only time.
start_date: fields.datetime('Start Date')
start = datetime.strptime(start_date, "%d-%m-%Y %H:%M:%S")
value['start_time'] = start.strftime("%d-%m-%Y %H:%M:%S")
This will give o/p in datetime format.I need only time.
You have to convert the datetime of string into datetime format and then convert it into string by extracting time only:
from datetime import datetime
start_dt = datetime.strptime(start_date, "%d-%m-%Y %H:%M:%S") # convert into datetime fromat
value['start_time'] = datetime.strftime(start_dt, "%H:%M:%S") # convert into string format and extract time only
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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 10/23/15, 4:13 AM|
|Seen: 2328 times|
|Last updated: 10/23/15, 5:59 AM|