php数据库统计时间戳按照天分组输出

原文链接

/* 查询2015-12-01 至 2015-12-14 */
// 开始的时间戳
$startUnix = 1448899200; // 2015-12-01 00:00:00
// 结束的时间戳
$endUnix = 1450108800;   // 2015-12-15 00:00:00
 
$sql = 'select count(id) as register_count, FROM_UNIXTIME(register_time, '%Y-%m-%d') as datetime from table_name where register_time>= '.$startUnix.' and register_time < '.$endUnix group by datetime;
// 执行查询
...
发布了5 篇原创文章 · 获赞 0 · 访问量 774

猜你喜欢

转载自blog.csdn.net/qq_36382924/article/details/82906198