/**
* Purpose:获取当天0时0分0秒的时间
* @author Hermanwang
* @return
* @return Date
*/
public static String todayFirstDate() {undefined
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateStr = sdf.format(calendar.getTime());
return dateStr;
}
/**
* Purpose:获取当天23时23分59秒的时间
* @author Hermanwang
* @return
* @return Date
*/
public static String todayLastDate() {undefined
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
calendar.set(Calendar.MILLISECOND, 999);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateStr = sdf.format(calendar.getTime());
return dateStr;
}
java 获取当天0时0分0秒和 23时23分59秒 的时间
最新推荐文章于 2024-08-23 10:48:16 发布