String perfTimeStr = "";
// 统一设置日历格式
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.set(Calendar.DATE, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
// 时间戳存在用指定的,不存在使用当前日期
if(perfTime > 0){
Calendar calPerfTime = Calendar.getInstance();
calPerfTime.setTime(new Date(perfTime));
calendar.set(Calendar.YEAR,calPerfTime.get(Calendar.YEAR));
calendar.set(Calendar.MONTH, calPerfTime.get(Calendar.MONTH));
}
//获取时间戳,并转换成____-MM-01 00:00:00格式
DateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
perfTimeStr = format.format(calendar);
perfTimeStr = perfTimeStr.replace(perfTimeStr.substring(0,4), "____");
//获取时间戳,并转换成DATE类型,yyyy-MM-01 00:00:00格式
Date startTime = calendar.getTime();