May be that I did not understand something about Mathematica pattern matching, but I noticed what follow:
st is a string, inside the string there is a date (Italian format) so I picked this code to extract the date:
st = "aaa ddd f f 20/06/2018 ppp mm l l ooo";
pattern = {"Day", "/", "Month", "/", "Year"};
dateTime = StringCases[st, ___ ~~ x : DatePattern[pattern] ~~ ___ :> x]
{"20/06/2018"}
Every seems to work, but if the day is 21 or 22 or 23 the command gives a wrong day:
someStringDate = {"01/06/2018", "02/06/2018", "10/06/2018", "11/06/2018", "12/06/2018",
"20/06/2018", "21/06/2018", "22/06/2018", "30/06/2018", "31/06/2018"};
pattern = {"Day", "/", "Month", "/", "Year"};
dateTime =
StringCases[
someStringDate, ___ ~~ x : DatePattern[pattern] ~~ ___ :> x]
{{"1/06/2018"}, {"2/06/2018"}, {"10/06/2018"}, {"1/06/2018"}, {"2/06/2018"}, {"20/06/2018"}, {"1/06/2018"}, {"2/06/2018"}, {"30/06/2018"}, {"1/06/2018"}}
Have you noticed what happens? Does it happen to you too?
PS: I forgot to add the version info
$Version
"11.3.0 for Microsoft Windows (64-bit) (March 7, 2018)"