【发布时间】:2015-07-15 09:01:56
【问题描述】:
我在 MySQL 表中有列 view_to_date,其中日期格式为 '04.05.2015'。
我想选择 view_to_date
【问题讨论】:
-
dev.mysql.com/doc/refman/5.6/en/… 然后开始修复您的表格,以便您的日期存储为 NATIVE 日期/时间值,而不是(无用的)字符串。
-
str_to_date('04.05.2015','%d.%m.%Y') < curdate() -
也可能是这个,这取决于它是上面提到的 m/d/y 还是 d/m/y
str_to_date('04.05.2015','%m.%d.%Y') < curdate() -
非常感谢,成功了!
-
SELECT * FROM test_date WHERE str_to_date(view_to_date,'%d.%m.%Y') < curdate()