How can I parse a datetime string in this format 'Mon, 04 Aug 2014 10:26:20 GMT' to compare it to the current date ?
Asked
Active
Viewed 66 times
1 Answers
0
You have to use datetime.strptime
>>> from datetime import datetime
>>> datetime.strptime(a, "%a, %d %b %Y %H:%M:%S %Z")
datetime.datetime(2014, 8, 4, 10, 26, 20)
This will convert your string to datetime
object which you can use for further process.

Nilesh
- 20,521
- 16
- 92
- 148