If the only problem is to insert hyphens, then here is a solution o your problem:
$sOldDate = "19790912";
$sDate = ereg_replace( '([0-9]{4})([0-9]{2})([0-9]{2})$', '\1-\2-\3', $sOldDate );
echo $sDate;
A better approach is probably to use mktime and date. But, for this single problem, the code above works just fine 😉
/ Ronnie