0

This should be a simple fix, but I can not figure out why I keep getting this error:

DATE = '8/27/2012 19:12:00'
Convert = datetime.strptime(DATE, '%d/%m/%Y %H:%M:%S')


ValueError: time data '8/27/2012 19:12:00' does not match format '%d/%m/%Y %H:%M:%S'

Am I missing something? does the month need to be "08"?

Thanks

1 Answer 1

1

Your day and month are flipped; month can't take a value of 27:

>>> convert = datetime.strptime(DATE, '%m/%d/%Y %H:%M:%S')
>>> convert
datetime.datetime(2012, 8, 27, 19, 12)
Sign up to request clarification or add additional context in comments.

2 Comments

@JeffSaltfist You may consider accepting the answer if it helped :)
Yes, sorry for the delay.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.