所以mysql有一个时间(类型),其中存储了一个24小时时钟,可以使用mysql函数date_format()以am/pm格式输出时间。唯一的问题是,当用户没有选择时间时,存储在 mysql 数据库中的值是 00:00:00,当我用 php 回显时,结果是 12:00am。那么我该如何构建它,以便它可以区分空值和 00:00:00(即凌晨 12:00)之间的区别? (顺便说一句,我尝试在时间列中插入 null,结果是 00:00:00,即上午 12:00)。
最佳答案
So how would i frame it so it can tell a difference between a null value and 00:00:00 which is 12:00am? (Btw, i try inserting null into the time column, turns out to be 00:00:00, which is 12:00am).
使该列可为空。 (删除 NOT NULL 约束。)
关于php - Mysql解释00 :00:00 as 12:00am?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5386187/