日期:2014-05-17  浏览次数:20424 次

mysql时间存储问题
时间前台显示 xx时xx分 时间是前台填写的 怎么存进数据库和读取?

------解决方案--------------------
有字段类型是什么类型啊。存成对应的类型格式就好了啊

像DATE xxxx-xx-xx
DATETIME xxxx-xx-xx xx:xx:xx
TIME xx:xx:xx

------解决方案--------------------
$s = '16时48分';
//$s = '16:48';
echo date('H:i:s' , strtotime(preg_replace('/[^\d]/', '', $s)));

得到 16:48:00
这就是你需要写入 time 类型字段的数据