I need to format a value for date ... I search for the following value link:
20181107
In case it would be 07/11/2018, today. I need to get this value and format it in 2018-11-07
format, I tried it as follows:
date('Y-m-d', strtotime('20181107'));
But in some cases it puts the day in the place of the month, then I wanted a solution for that or just a code that inserted a hyphen after 4 digits and after 6 digits, it would be simpler too.