Correction: in my example, I referenced y. That's not the actual code, I had changed 'y' to 'exampledate' to try to make it more readable and missed one. The line 'testTime = time.strptime(y, "%Y-%m-%d %H:%M:%S")' should read 'testTime = time.strptime(exampledate, "%Y-%m-%d %H:%M:%S")'