+ 1

Convert dates with python

I'm scraping dates like this from facebook. "3 hrs ago" "Yesterday at 9:34 AM" "March 24 at 11:30 AM" I need to convert them to basic 24h date format "26.3.2019 9:34"

26th Mar 2019, 9:38 PM
Toni Isotalo
Toni Isotalo - avatar
2 Respuestas
26th Mar 2019, 9:47 PM
dρlυѕρlυѕ
dρlυѕρlυѕ - avatar
+ 7
I'd suggest using regex to find expressions like "xy hrs ago" or "Yesterday at x:yz AM/PM" and calculating the time offset with datetime.timedelta. I played around with regex a bit: https://code.sololearn.com/cPsgJMwgGPmG/?ref=app
26th Mar 2019, 10:55 PM
Anna
Anna - avatar