You could use [man]preg_match/man, e.g.,
<?php
$filename = '123-20080327165347-01.jpg';
$pattern = '/\d+-(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)-\d+\.jpg/i';
if (preg_match($pattern, $filename, $matches)) {
echo $matches[3] . '/' . $matches[2] . '/' . $matches[1] . ' '
. $matches[4] . ':' . $matches[5] . ':' . $matches[6];
} else {
echo 'Invalid format!';
}
?>
Though substr() still sounds reasonable to me.