How to pick time only in Datetime field in odoo 10
Pertanyaan ini telah diberikan tanda
5
Replies
14526
Tampilan
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
Menikmati diskusi? Jangan hanya membaca, ikuti!
Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!
Daftar| Post Terkait | Replies | Tampilan | Aktivitas | |
|---|---|---|---|---|
|
Datetime change Format issue in odoo10??
Diselesaikan
|
|
1
Sep 19
|
15046 | |
|
|
2
Jul 25
|
9815 | ||
|
How to send messages that are not shown in chatter?
Diselesaikan
|
|
2
Okt 25
|
11609 | |
|
How to ORDER BY? [Odoo 10]
Diselesaikan
|
|
2
Nov 24
|
32372 | |
|
|
2
Mei 24
|
10409 |
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.