Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道如何最好地将日期和时间以 04 sunday, 2013 格式插入到数据库表中。我一直在尝试但一直插入为 2013-09-16 。谢谢
这是我的 sql 代码:
$query = "INSERT INTO topic_created (subject , dateposted) VALUES ('$subject', CURDATE())"; mysql_query ($query) or die ('could not updated:'.mysql_error());
最好的办法是不碰它。您在检索数据时进行日期格式设置。日期有一个数据类型,您应该这样存储它。
SELECT DATE_FORMAT(dateposted, '...') ...
文档