Reputation: 1520
The GNU 'date' utility is awesome. I can feed it all sorts of dates and it can handle all of them, and convert them to whatever string format I want. Some examples are...
today
tomorrow
next thurs
next April
Aril 1
last year
1 month ago
2019-10-07
Is there an easy way to handle this flexibility with python3? I want to accept as many date formats as possible from the user, then convert them to %Y-%m-%d
before printing to stdout.
Upvotes: 0
Views: 45
Reputation: 470
Have A look at dateparser library in python :
https://dateparser.readthedocs.io/en/latest/
It will parse the above mentioned dates along with searching the dates in sentences, supporting different languages etc.
Upvotes: 1