在mysql数据库中使用int类型保存时间戳时,一般在程序中可能会用到统计当日,当月的一些数据。那么可以用如下的方式限定时间范围:
//当日销售
$today_start = strtotime(date('Y-m-d 00:00:00'));
$today_end = strtotime(date('Y-m-d 23:59:59'));
//本月销售
$month_start = strtotime(date("Y-m-01"));
$month_end = strtotime("+1 month -1 seconds", $month_start);