@Test public void pastWeekStartTest() { System.out.println(sdf.format(TimeUtils.fewDaysAgoBegin(-1))); System.out.println(sdf.format(TimeUtils.fewDaysAgoBegin(0))); System.out.println(sdf.format(TimeUtils.fewDaysAgoBegin(7))); System.out.println(sdf.format(TimeUtils.fewDaysAgoBegin(31))); System.out.println(sdf.format(TimeUtils.fewDaysAgoEnd(-1))); System.out.println(sdf.format(TimeUtils.fewDaysAgoEnd(0))); System.out.println(sdf.format(TimeUtils.fewDaysAgoEnd(7))); System.out.println(sdf.format(TimeUtils.fewDaysAgoEnd(31))); }
public static Date pastWeekStart() { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) - 7); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); return new Date(calendar.getTime().getTime()); }
TimeUtils { public static Date pastWeekStart() { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) - 7); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); return new Date(calendar.getTime().getTime()); } }
TimeUtils { public static Date pastWeekStart() { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) - 7); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); return new Date(calendar.getTime().getTime()); } private  TimeUtils(); }
TimeUtils { public static Date pastWeekStart() { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) - 7); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); return new Date(calendar.getTime().getTime()); } private  TimeUtils(); static String nowStr(); static String date2Str(Date date); static String date2Str(long date); static int month(); static Date yesterdayBegin(); static Date yesterdayEnd(); static Date pastWeekStart(); static Long howLongBeginThisMonth(); static Date beginThisMonth(); static Date lastMonthTodayInBegin(); static Date lastFewDaysInBegin(Integer days); static Date fewDaysAgoEnd(int index); static Date fewDaysAgoBegin(int index); static Date endMonth(int year, int month); static Date beginMonth(int year, int month); static Date zeroTimeZone(Date date); static String nowTimeWithZone(); }
TimeUtils { public static Date pastWeekStart() { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) - 7); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); return new Date(calendar.getTime().getTime()); } private  TimeUtils(); static String nowStr(); static String date2Str(Date date); static String date2Str(long date); static int month(); static Date yesterdayBegin(); static Date yesterdayEnd(); static Date pastWeekStart(); static Long howLongBeginThisMonth(); static Date beginThisMonth(); static Date lastMonthTodayInBegin(); static Date lastFewDaysInBegin(Integer days); static Date fewDaysAgoEnd(int index); static Date fewDaysAgoBegin(int index); static Date endMonth(int year, int month); static Date beginMonth(int year, int month); static Date zeroTimeZone(Date date); static String nowTimeWithZone();  }