[英]Date comparison with php
How can I comparison date as dd/mm/YY. 如何比较日期为dd / mm / YY。 I want to get data from db greater than or equal the current date ;
我想从db中获取大于或等于当前日期的数据; Code like this
像这样的代码
$current_date = date("d/m/Y");
mysql_query("SELECT * FROM pages WHERE date>='".current_date."'");
But doesnt work? 但是行不通吗?
Don't use php time in MySQL if there is no serious reasons for it. 如果没有严重的原因,请不要在MySQL中使用php time。 In your situation the best way is
SELECT * FROM pages WHERE date>=NOW()
在您的情况下最好的方法是
SELECT * FROM pages WHERE date>=NOW()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.