I've put together a very simple function to invert the date, see:
function inverteData($data) {
if(count(explode("/",$data)) > 1){
return implode("-",array_reverse(explode("/",$data)));
}
else if(count(explode("-",$data)) > 1) {
return implode("/",array_reverse(explode("-",$data)));
}
}
Example 1 of how it works:
inverteData("10/02/2006");
It returns me 2006-02-10
Example 2 of how it works:
inverteData("2006-02-10");
It returns me 10/02/2006
Well I need to make it convert the following date as well: (200206) to (2006-02-20).
Can anyone help me?