php 时间转换日期与日期转换成时间
$d ='2009-07-02 09:09:00';
echo date("Y-m-d",'1246606382');
echo date('Ymd',dateToTime($d));
$temp = dateToTime($d);
echo $temp;
echo date("Y-m-d",$temp);
function dateToTime($d)
{
$year=((int)substr("$d",0,4));//取得年份
$month=((int)substr("$d",5,2));//取得月份
$day=((int)substr("$d",8,2));//取得几号
return mktime(0,0,0,$month,$day,$year);
}
?>