I have strings that show a date in the following format:
x minutes/hours/days/months/years ago
I need to parse that to a datetime using pyt
Easiest way is to use dateparser:
import dateparser date_ago="4 months ago" date=dateparser.parse(date).strftime("%Y-%m-%d") date
Output:
'2020-01-08'