Mysql其中一个字段以时间戳形式存储日期,怎样查询当前时间和这个日期相差30天内的数据!

2025-03-01 15:15:14
推荐回答(1个)
回答1:

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