Home  >  Article  >  Backend Development  >  在php MYSQL中插入当前时间_php技巧

在php MYSQL中插入当前时间_php技巧

WBOY
WBOYOriginal
2016-05-17 09:37:441164browse

NOW()函数以`'YYYY-MM-DD HH:MM:SS'返回当前的日期时间,可以直接存到DATETIME字段中。

CURDATE()以'YYYY-MM-DD'的格式返回今天的日期,可以直接存到DATE字段中。

CURTIME()以'HH:MM:SS'的格式返回当前的时间,可以直接存到TIME字段中。

例:insert into tablename (fieldname) values (now()) 

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