php将字符串转化成date存入数据库的两种方式


$date = "2011-12-12";
$year=((int)substr($date,0,4));//取得年份
$month=((int)substr($date,5,2));//取得月份
$day=((int)substr($date,8,2));//取得几号
$_date = date("M-d-Y",mktime(0,0,0,$month,$day,$year));

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/08bae96622d42715ae1bf51ced45f80a.html