Skip to Content
Menu
This question has been flagged
5 Replies
11670 Views
Best Answer
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
Avatar
Discard
Best Answer

dt = datetime.datetime.strptime(string,'%Y-%m-%d %H:%M:%S')

time = dt.time()

date = dt.date()

Avatar
Discard
Best Answer

check_in_date = datetime.strptime(check_in, "%Y-%m-%d %H:%M:%S").date()

Avatar
Discard
Best Answer

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


Avatar
Discard
Related Posts Replies Views Activity
1
Sep 19
12166
2
Nov 24
25066
2
May 24
5512
3
Mar 24
4962
0
Mar 24
261