public static Date getLastDayFromCurrentWeek ( Date d ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( d ) ; // depends on Locale (if a week starts on Monday or on Sunday) if ( cal . getFirstDayOfWeek ( ) == Calendar . SUNDAY ) { cal . add ( Calendar . WEEK_OF_YEAR , 1 ) ; } cal . set ( Calendar . DAY_OF_WEEK , Calendar . SUNDAY ) ; cal . set ( Calendar . HOUR_OF_DAY , 23 ) ; cal . set ( Calendar . MINUTE , 59 ) ; cal . set ( Calendar . SECOND , 59 ) ; cal . set ( Calendar . MILLISECOND , 999 ) ; return cal . getTime ( ) ; }
Get last date from current week