sql时间处理:
https://blog.csdn.net/the_it_world/article/details/100743945
改成精确到天
DATE_FORMAT(app_last_time,'%Y-%m-%d')
--------------------------------------------------------------------------------------------------------
创建时间精确到天
SimpleDateFormat bartDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date();
bartDateFormat.format(date);
昨天
public static String getLastDay(String time){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
Date date=null;
try {
date = sdf.parse(time);
} catch (ParseException e) {
e.printStackTrace();
}
calendar.setTime(date);
int day=calendar.get(Calendar.DATE);
// 此处修改为+1则是获取后一天
calendar.set(Calendar.DATE,day-1);
String lastDay = sdf.format(calendar.getTime());
return lastDay;
}