Home >Backend Development >PHP Tutorial > 时间有关问题

时间有关问题

WBOY
WBOYOriginal
2016-06-13 13:49:291110browse

时间问题?
我想取得当前时间(年月日时分)存到数据库中,表中字段类型为datetime.

$logtime=date( "Y年m月d日   H:i:s ",$datetime)   ;
取得的时间都是 '1970年01月01日   00:00:00,而且插入数据库出错:
Incorrect   datetime   value:   '1970年01月01日   00:00:00 '   for   column   'logtime '   at   row   1

------解决方案--------------------
datatime的格式是YYYY-MM-DD HH:MM:SS

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