Java Day of Week getWeekOfYear(Date date)

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

Description

get Week Of Year

License

Apache License

Declaration

public static int getWeekOfYear(Date date) 

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 getWeekOfYear(Date date) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);//from  ww  w. j a va 2 s  .  co  m
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        cal.setFirstDayOfWeek(Calendar.SUNDAY);
        cal.setMinimalDaysInFirstWeek(1);
        return cal.get(Calendar.WEEK_OF_YEAR);
    }
}

Related

  1. getWeekOfTheYear(Date aDate)
  2. getWeekOfTheYear(final Date dateOfYear)
  3. getWeekOfYear(Date d, Locale locale)
  4. getWeekOfYear(Date date)
  5. getWeekOfYear(Date date)
  6. getWeekOfYear(String date)
  7. getWeeksBetweenDate(Date begin, Date end)
  8. getWeekStart(Date date)
  9. getWeekStart(Date date)