Answers for "str to datetime time"

2

convert str to datetime

import datetime

# str value "Apr 2, 2019" convert into any format. 
datetime.datetime.strptime('Apr 2, 2019', '%b %d, %Y').strftime('%a, %d %b %Y')
Posted by: Guest on May-13-2020
0

str to datetime time

>>> import datetime
>>> datetime.datetime.strptime('03:55', '%H:%M').time()
datetime.time(3, 55)
Posted by: Guest on June-06-2021

Python Answers by Framework

Browse Popular Code Answers by Language