$month = date("Y-m");//月if ($month != '') { $sql = $sql . " and UNIX_TIMESTAMP(数据库时间字段) >= ".strtotime(date("Y-m",time()))." and UNIX_TIMESTAMP(数据库时间字段) <= ".time();}