+ 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"
2 ответов
+ 2
Have you tried to import and use datetime?
https://stackoverflow.com/questions/466345/converting-string-into-datetime
+ 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