Home > Backend Development > PHP Tutorial > php日期加减

php日期加减

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-23 13:42:19
Original
999 people have browsed it

对于每天的统计数据,我们日期 date("Ymd") 转换成整型来作为数据库的主键,所以在寻找一段时间统计数据的时候需要用到时间的加减;

例如,30天内的数据

function getData($writetime , $limit){	$start_unix = strtotime($start);	for ($i = 0; $i < $limit; $i++) {		$writetime = date("Ymd", $start_unix);		_stdout($writetime);		$start_unix -= 3600 * 24;	}}
Copy after login

关于统计数据库的可视化,我们一直在找办法,现在是利用后台计算,过滤数据,得到我们想要的统计数据,但Mysql进行group by 这些操作的速度实在是慢,希望能得到建议。


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template