mysql时间存储有关问题

WBOY
Release: 2016-06-13 13:32:06
Original
1146 people have browsed it

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 类型字段的数据

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!