DateTime使用

Date todayTime = new DateTime().withTimeAtStartOfDay().toDate();//今天凌晨
 
 
 Date tomorrowTime = new DateTime().plusDays(1).withTimeAtStartOfDay().toDate();//昨日凌晨
 
 
Date theWeekStartTime = new DateTime().minusDays(new DateTime().getDayOfWeek()-1).withTimeAtStartOfDay().toDate();//本周开始时间
 
 
 
Date theWeekEndTime = new DateTime().plusDays(8-new DateTime().getDayOfWeek()).withTimeAtStartOfDay().toDate();//本周结束时间
 
 
 
Date theMonthStartTime = new DateTime().minusDays(new DateTime().getDayOfMonth()-1).withTimeAtStartOfDay().toDate();//本月开始时间
 
 
 
Date theMonthEndTime = new DateTime().minusDays(new DateTime().getDayOfMonth()-1).plusMonths(1).withTimeAtStartOfDay().toDate();//本月结束时间

你可能感兴趣的:(技术总结)