Java Year Week getMaxWeekNumOfYear(int year)

Here you can find the source of getMaxWeekNumOfYear(int year)

Description

get Max Week Num Of Year

License

Apache License

Declaration

public static int getMaxWeekNumOfYear(int year) 

Method Source Code

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

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

public class Main {

    public static int getMaxWeekNumOfYear(int year) {
        Calendar c = new GregorianCalendar();
        c.set(year, Calendar.DECEMBER, 31, 23, 59, 59);
        return getWeekOfYear(c.getTime());
    }/* w  w w .  j a  v a  2 s  .c  o m*/

    public static int getWeekOfYear(Date date) {
        Calendar c = new GregorianCalendar();
        c.setFirstDayOfWeek(Calendar.MONDAY);
        c.setMinimalDaysInFirstWeek(7);
        c.setTime(date);
        return c.get(Calendar.WEEK_OF_YEAR);
    }
}

Related

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