date command is quite flexible in recognizing strings that represent dates. So, for example:
$ date -d 'Oct 29 2018'
Mon Oct 29 00:00:00 CET 2018
-d flag instructs
date to display the date given to it as a string.
You can add the
+FORMAT parameter to convert the date as you like. For example:
$ date -d 'Oct 29 2018' '+%Y-%m-%d'
man date for the option you have to set the output format.
Sorry, I didn't get your reference to
-mtime. Are you talking about the
find filter? If so, I guess you need the difference between today and your
OLDEST_DATE, in days.
You can obtain it by converting dates to the Epoch format (seconds since 1970-01-01 00:00:00 UTC). For example:
$ current="$(date '+%s')"
$ oldest_date_epoch="$(date -d "$OLDEST_DATE" '+%s')"
$ diff_days=$(( ("$current" - "$oldest_date_epoch") / (3600 * 24) ))
Note this is not a general solution, since
date cannot understand foreign languages.