How to pick time only in Datetime field in odoo 10
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- ลูกค้าสัมพันธ์
- e-Commerce
- ระบบบัญชี
- สินค้าคงคลัง
- PoS
- Project
- MRP
คำถามนี้ถูกตั้งค่าสถานะ
5
ตอบกลับ
12588
มุมมอง
How to pick time only in Datetime field in odoo 10
import datetime
string = '2018-05-17 10:44:50'
dt = datetime.datetime.strptime(string,'%Y-%m-%d %H:%M:%S')
print dt.time()
print dt.time().hour
print dt.time().minute
# output
10:44:50
10
44
dt = datetime.datetime.strptime(string,'%Y-%m-%d %H:%M:%S')
time = dt.time()
date = dt.date()
check_in_date = datetime.strptime(check_in, "%Y-%m-%d %H:%M:%S").date()
Hello
from datetime import datetime
date = field.Datetime(string='Date')
On_your_method
get_time = datetime.datetime.strptime(date,'%Y-%m-%d %H:%M:%S')
final_time = get_time.time()
print "final time", final_time
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อRelated Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
---|---|---|---|---|
Datetime change Format issue in odoo10??
แก้ไขแล้ว
|
|
1
ก.ย. 19
|
13174 | |
|
2
ก.ค. 25
|
4479 | ||
|
2
ธ.ค. 24
|
7663 | ||
How to ORDER BY? [Odoo 10]
แก้ไขแล้ว
|
|
2
พ.ย. 24
|
28426 | |
|
2
พ.ค. 24
|
7394 |
Date manipulation in python:
1- http://learnopenerp.blogspot.com/2018/01/python-date-manipulation.html
2- http://learnopenerp.blogspot.com/2018/02/python-strftime-datetime-formatting.html
3- http://learnopenerp.blogspot.com/2018/02/python-timedelta.html
Hope it will works for you.