Date Extraction in Python I would like to extract all date information from a given document. Essentially, I guess this can be done with a lot of regexes:


2019-02-20
20.02.2019 ("German format")
02/2019 ("February 2019")
"tomorrow" (datetime.timedelta(days=1))
"yesterday" (datetime.timedelta(days=-1))


Is there a Python package / library which offers this already or do i have to write all of those regexes/logic myself?

I'm interested in Information Extraction from German and English texts. Mainly German, though.

Constraints

I don't have the complete dataset by now, but I have some idea about it:


10 years of interesting dates which could be in the dataset
I guess the interesting date types are: (1) 28.02.2019, (2) relative ones like "3 days ago" (3) 28/02/2019, (4) 02/28/2019 (5) 2019-02-28 (6) 2019/02/28 (7) 2019/28/02 (8) 28.2.2019 (9) 28.2 (10) ... -- all of which could have spaces in various places
I have millions of documents. Every document has around 20 sentences, I guess.
Most of the data is in German
Stanford CoreNLP has a very good implementation of NER for date/time. 

https://nlp.stanford.edu/software/sutime.html   (demo: http://nlp.stanford.edu:8080/sutime/process)



Though this is written in Java, there are quite a few Python wrappers for this library (Such as : https://github.com/FraBle/python-sutime).  List of such libraries : https://stanfordnlp.github.io/CoreNLP/other-languages.html