/**
* 获取当年第一天
* @return
*/
private String getCurentYearFistDay(){
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DateFormatUtils.DATE_DAY_FORMATE);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_YEAR,1);
log.info("获取当年第一天={}" , simpleDateFormat.format(calendar.getTime()));
return simpleDateFormat.format(calendar.getTime());
}
/**
* 获取当月第一天
* @return
*/
private String getCurentMonthFistDay(){
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DateFormatUtils.DATE_DAY_FORMATE);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH,1);
log.info("获取当月第一天={}" , simpleDateFormat.format(calendar.getTime()));
return simpleDateFormat.format(calendar.getTime());
}
/**
* 获取今天最早时间
* @return
*/
private String getTodayFistTime(){
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DateFormatUtils.DATE_DAY_FORMATE);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY,0);
log.info("获取今天最早时间={}" , simpleDateFormat.format(calendar.getTime()));
return simpleDateFormat.format(calendar.getTime());
}
/**
* 获取昨天最早时间
* @return
*/
private String getYesTodayFistTime(){
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DateFormatUtils.DATE_DAY_FORMATE);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY,-1);
log.info("获取昨天最早时间={}" , simpleDateFormat.format(calendar.getTime()));
return simpleDateFormat.format(calendar.getTime());
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)