PHP: Date Format Change

function DateChangeFormat($str,$old_format,$new_format){
        $date=DateTime::createFromFormat($old_format,$str);
        return $date->format($new_format);
        }