Home >Backend Development >PHP Tutorial >1990-2-10 这样的格式存入数据库变成 1990-2-10 00:00:00 肿么办啊

1990-2-10 这样的格式存入数据库变成 1990-2-10 00:00:00 肿么办啊

WBOY
WBOYOriginal
2016-06-23 13:34:03919browse

$sri = "1990";
$sri="2";
$sri="10";
$sri = $sri_n."-".$sri_y."-".$sri_r;

存储该数据的字段类型为datetime;

是数据库字段问题么 还是怎么回事啊...


回复讨论(解决方案)

datetime 就包括年月日时分秒。你没有填入时分秒就会填入默认的00:00:00

如果你的数据只有年月日,可以用date类型。

字段类型改为date即可。

 谢谢两位版主

Statement:
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