this is working
datetime.strptime('2012-03-01T10:00:00Z', '%Y-%m-%dT%H:%M:%SZ')
same need to do for
datetime.strptime('Mon Mar 14 05:21:08 UTC 2022', '<format>')
what would be format for same
this is working
datetime.strptime('2012-03-01T10:00:00Z', '%Y-%m-%dT%H:%M:%SZ')
same need to do for
datetime.strptime('Mon Mar 14 05:21:08 UTC 2022', '<format>')
what would be format for same
You can use the parser in dateutil.
from dateutil import parser
my_date = parser.parse('Mon Mar 14 05:21:08 UTC 2022')
print(my_date) # datetime.datetime(2022, 3, 14, 5, 21, 8, tzinfo=tzutc())
Just to explicitly provide the corresponding format code for that timestamp
>>> datetime.strptime('Mon Mar 14 05:21:08 UTC 2022', '%a %b %d %H:%M:%S %Z %Y')
datetime.datetime(2022, 3, 14, 5, 21, 8)