In my project I have a string like this one:
"2018-03-07 06:46:02.737951"
I would like to get two variables: one in date format that contains the data, and the other for the time.
I tried:
from datetime import datetime
datetime_object = datetime.strptime('2018-03-07 06:46:02.737951', '%b %d %Y %I:%M%p')
but I get an error.
Then I tried:
from dateutil import parser
dt = parser.parse("2018-03-07 06:46:02.737951")
but I don't know what I can do with these results.
How can I extract the values for my vars "date_var" and "time_var"?