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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:20:311106browse

1990-2-10 这样的格式存入数据库变成 1990-2-10 00:00:00 肿么办啊
$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