Java Day of Week getBounceDateofWeek(Date date)

Here you can find the source of getBounceDateofWeek(Date date)

Description

get Bounce Dateof Week

License

Open Source License

Parameter

Parameter Description
date a parameter

Return

array of two date elements, first is the first day of week, and the second is the end week date

Declaration

public static Date[] getBounceDateofWeek(Date date) 

Method Source Code

//package com.java2s;
/**/*from  w  ww .ja v a  2  s  .c o m*/
 * This file is part of mycollab-core.
 *
 * mycollab-core is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * mycollab-core is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with mycollab-core.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class Main {
    /**
     * 
     * @param date
     * @return array of two date elements, first is the first day of week, and
     *         the second is the end week date
     */
    public static Date[] getBounceDateofWeek(Date date) {
        Calendar calendar = new GregorianCalendar();
        calendar.setFirstDayOfWeek(Calendar.MONDAY);
        calendar.setTime(date);
        calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
        Date begin = calendar.getTime();

        calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
        Date end = calendar.getTime();
        return new Date[] { begin, end };
    }
}

Related

  1. extractDayOfWeek(Date date)
  2. findDayOfWeek(String threeLetters)
  3. firstDateAfterAddWeeks(Date early, int weeks)
  4. firstDayOfWeek()
  5. getAllDaysDateBetween(Date startDate, Date endDate, DayOfWeek dayOfWeek)
  6. getDateByWeek(int week)
  7. getDateByYearAndWeekNum(int year, int weekNum)
  8. getDateForCurrentWeekDay(int day)
  9. getDateOfWeek(int week)