Home  >  Article  >  Backend Development  >  Insert current time in php MYSQL_PHP tutorial

Insert current time in php MYSQL_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:52:24880browse

The NOW() function returns the current date and time as `'YYYY-MM-DD HH:MM:SS', which can be directly stored in the DATETIME field.

CURDATE() returns today's date in the format of 'YYYY-MM-DD', which can be directly stored in the DATE field.

CURTIME() returns the current time in the format of 'HH:MM:SS', which can be directly stored in the TIME field.

Example: insert into tablename (fieldname) values ​​(now())

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/318941.htmlTechArticleNOW() function returns the current date and time with `'YYYY-MM-DDHH:MM:SS', you can Store directly into the DATETIME field. CURDATE() returns today's date in the format of 'YYYY-MM-DD', which can be directly saved to DA...
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