$startime = time() - 3600 * 24 * 30);$endtime = time();$sql = SELECT * FROM `table` WHERE `endtime` between ".$startime." and ".$endtime;