目录

​获取当天的零点时间戳(00:00:00)​

​获取当天的12点时间戳(23:59:59)​


获取当天的零点时间戳(00:00:00)

/**
*
*
* @return 当天的零点时间戳
*/
public static long getTodayStartTime() {
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
return calendar.getTime().getTime();
}


获取当天的12点时间戳(23:59:59)

/**
*
*
* @return 当天的零点时间戳
*/
public static long getTodayEndTime() {
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
return calendar.getTime().getTime();
}