In reply to Francois.

You can use pdftotext to extract a date from a document, though it gets a bit more complicated when there are multiple dates in the document.

Example here: https://akrabat.com/renaming-pdf-files-based-on-their-content/