Java Week Calculate getWeek(Date date)

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

Description

get Week

License

Open Source License

Declaration

public static int getWeek(Date date) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {

    public static int getWeek(Date date) {
        Calendar c = Calendar.getInstance();
        c.setTime(date);/*from ww  w.j  a v  a2  s.co  m*/
        int day = c.get(Calendar.DAY_OF_WEEK);
        if (day == 1) {
            return 7;
        } else {
            return day - 1;
        }
    }
}

Related

  1. getBounceDatesOfWeek(Date date)
  2. getCurrentWeekNum(Date startDate, Date endDate)
  3. getCurrWeek()
  4. getEndOfWeek(Calendar cal)
  5. getSeqWeek()
  6. getWeekAbscissa(Class cls)
  7. getWeekNumberFromDate(Date date)
  8. getWeekOfDate(Date date)
  9. getWeekOfYear(Date date, Locale locale)