php按数组中的时间字段分组

$data = $db->select('am_table_main', '*',['ORDER'=>['added_time'=>'DESC']]);

$new_data = [];
foreach($data as $key => &$val){
	$val['month'] = mb_substr($val['added_time'], 0 ,7);
	$new_data[$val['month']][] = $val;
}
unset($val);

上一篇:[官方文档]MySQL 5.7关键字和保留字


下一篇:python中while循环