在mysql中处理时间戳
把mysql中时间戳转化成正常时间, 用mysql函数: from_unixtime(数据库time字段,“%Y%m%d”);
例如,按月统计:
1
select count(id), from_unixtime(select_time,'%Y-%m') as result, from_unixtime(select_time,'%Y')as year, from_unixtime(select_time,'%m') as month
2
from diray
3
group by year, month
4
order by year desc, month desc
select count(id), from_unixtime(select_time,'%Y-%m') as result, from_unixtime(select_time,'%Y')as year, from_unixtime(select_time,'%m') as month2
from diray3
group by year, month 4
order by year desc, month desc
可以歇歇了!!
浙公网安备 33010602011771号