php日付整形

#———————————————————————
#20090230 を2009年03月20日に
function TimeSet($value){
$y = substr($value,0,4);
$m = substr($value,4,2);
$d = substr($value,6,2);
if($d) {
$ret = $y.”年”.$m.”月”.$d.”日”;
}else{
$ret = $y.”年”.$m.”月”;
}
return $ret;
}
#———————————————————————
#2009-02-30 を2009年03月20日に
function TimeSet2($value){
$y = substr($value,0,4);
$m = substr($value,6,2);
$d = substr($value,8,2);
if($d) {
$ret = $y.”年”.$m.”月”.$d.”日”;
}else{
$ret = $y.”年”.$m.”月”;
}
return $ret;
}