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.
我在 mysql 表中有列日期时间。此列的默认值为“ 0000-00-00 00:00:00”。
0000-00-00 00:00:00
问题:检查值大于零的最佳方法是什么?
if (strtotime($datetime)>0)
if ($datetime=="0000-00-00 00:00:00")
PS:我用的是 Yii 框架
将日期与日期进行比较几乎总是一个好主意,在这种情况下,这将是一个不错的选择:
if (str_to_date($datetime)> str_to_date('0000-00-00 00:00:00'))