Home  >  Article  >  Backend Development  >  The format in which PHP date() function writes to mysql

The format in which PHP date() function writes to mysql

巴扎黑
巴扎黑Original
2016-11-23 10:23:452354browse

<?php 
echo date("Y-m-d"); 
//显示格式为:XXXX-XX-XX 
//必须使用上面这种格式存入mysql的date字段中 
echo date("Y-m-d H:i:s"); 
//显示格式为:XXXX-XX-XX XX:XX:XX 
//必须使用上面这种格式存入mysql的datetime字段中 
?>


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
Previous article:PHP caching mechanismNext article:PHP caching mechanism