Calendar

Calendar instance = Calendar.getInstance();
instance.clear();
instance.setTime(new Date());
instance.set(Calendar.HOUR_OF_DAY,23);
instance.set(Calendar.MINUTE,59);
instance.set(Calendar.SECOND,59);

Date etime = instance.getTime();

instance.set(Calendar.HOUR_OF_DAY,0);
instance.set(Calendar.MINUTE,0);
instance.set(Calendar.SECOND,0);
Date stime = instance.getTime();

String dateToStr = DateUtils.dateToStr(stime, "yyyy-MM-dd");
String dateToStr2 = DateUtils.dateToStr(etime, "yyyy-MM-dd");
posted @ 2018-06-13 14:02  wlhebut  阅读(289)  评论(0编辑  收藏  举报