php做一个时间搜索应该怎么做?在线等!

2025-03-23 03:51:35
推荐回答(2个)
回答1:

用where就可以,例如:

$startTime = strtotime("2013-10-01 10:10:10");//时间字符串转时间戳
$endTime   = strtotime("2013-12-01 10:10:10");

//table为表名,creatTime为创建时间
$sql = "select * from table where creatTime>=$startTime and creatTime<=$endTime;";
?>

回答2:

把你要搜索的日期转时间戳 然后sql语句