I’m trying to convert a string in the format:
Apr 18 17:19:42
to datetime so that I can compare the current time with that time and see if they are off by a minute. How do I do that?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As S1R has already pointed out, the
strptimemethod is what you want. You’ll also need to specify the year, since its not included in your date string: