Java Year Week getNextWeekMonday(int year, int weekOfYear)

Here you can find the source of getNextWeekMonday(int year, int weekOfYear)

Description

get Next Week Monday

License

Apache License

Declaration

public static Date getNextWeekMonday(int year, int weekOfYear) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

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

public class Main {
    public static int FIRST_DAY_OF_WEEK = Calendar.MONDAY;

    public static Date getNextWeekMonday(int year, int weekOfYear) {
        Date date = getMondayOfWeek(year, weekOfYear);
        return getNextWeekDate(date);
    }//from  w  w w .  j  a  va2  s  .com

    public static Date getMondayOfWeek(Date date) {
        Calendar monday = getCalendar();
        monday.setTime(date);
        monday.setFirstDayOfWeek(FIRST_DAY_OF_WEEK);
        monday.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
        return monday.getTime();
    }

    public static Date getMondayOfWeek(int year, int weekOfYear) {
        Calendar monday = getCalendar();
        monday.set(Calendar.YEAR, year);
        monday.set(Calendar.WEEK_OF_YEAR, weekOfYear + 1);
        monday.setFirstDayOfWeek(FIRST_DAY_OF_WEEK);
        monday.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
        return monday.getTime();
    }

    public static Date getNextWeekDate(Date date) {
        Calendar c = getCalendar();
        c.setTime(date);
        c.add(Calendar.WEEK_OF_YEAR, 1);
        return c.getTime();
    }

    private static Calendar getCalendar() {
        Calendar c = Calendar.getInstance();
        c.setFirstDayOfWeek(FIRST_DAY_OF_WEEK);
        return c;
    }
}

Related

  1. getEndDayByWeekOfYear(int year, int weekNo)
  2. getLastDayOfWeek(int year, int week)
  3. getLastWeekOfYear()
  4. getMaxWeekNumOfYear(int year)
  5. getNumberOfWeeksInYear(int year)
  6. getSeasonStartWeekOffset(int year)
  7. getStartDayOfWeekNo(int year, int weekNo)
  8. getTotalWeekOfYear(int year)