I need to check a string is match with some format, and i using DateTime::createFromFormat to enforce it. but it got some bugs.
example i have an date: 8/15/2020, i try to parse it to datetime object with format "d/m/Y", then i print it in to other format:
DateTime::createFromFormat("d/m/Y", '8/15/2020')->format('d-m-Y')
// result: 08-03-2021
that is wreig, because i read in php.net https://www.php.net/manual/en/datetime.createfromformat.php they said: d: day (1->30), m: month (1->12), Y: year (2020)
But i got an strange result? how it work? or it is the bug?
thank you for your answer.