I am using the default python string date and time format with the JSON web service.
Then I try to compare it with the actual time. And I also use timezone with pytz.utc .
Here is my string date:
print date 2013-02-26 21:28:37.261134+01:00
Trying to convert my string to datetime (change for timezone with pytz ):
if datetime.strptime(date, '%Y-%m-%d %H:%M:%S.%f+%Z') < datetime.now(pytz.utc):
Unfortunately, it does not work.
ValueError: time data '2013-02-26 21:28:37.261134+01:00' does not match format '%Y-%m-%d %H:%M:%S.%f%Z'
Can someone tell me the correct syntax for strptime format to use my date?
source share