/** Make a range which encompasses the current week. * The week is defined as Sunday thru Saturday. */ public static HDateTimeRange thisWeek(HTimeZone tz) { HDate today = HDate.today(); HDate sun = today.minusDays(today.weekday() - DayOfWeek.Sunday); HDate sat = today.plusDays(DayOfWeek.Saturday - today.weekday()); return(make(sun, sat, tz)); }
/** Make a range which encompasses the previous week. * The week is defined as Sunday thru Saturday. */ public static HDateTimeRange lastWeek(HTimeZone tz) { HDate today = HDate.today(); HDate prev = today.minusDays(7); HDate sun = prev.minusDays(prev.weekday() - DayOfWeek.Sunday); HDate sat = prev.plusDays(DayOfWeek.Saturday - prev.weekday()); return(make(sun, sat, tz)); }