Java Day of Week getWeekOfDay(Date date)

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

Description

get Week Of Day

License

Open Source License

Parameter

Parameter Description
date a parameter

Declaration

public static int getWeekOfDay(Date date) 

Method Source Code

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

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

public class Main {

    public static int getWeekOfDay(Date date) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);/*from  www . ja  va 2s. com*/
        int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
        if (w == 0) {
            w = Calendar.DAY_OF_WEEK;
        } else if (w < 0) {
            w = 0;
        }
        return w;
    }
}

Related

  1. getWeekNumber(Date date)
  2. getWeekNumber(Date date, Integer day)
  3. getWeekNumberFromDate(Date date)
  4. getWeekNumOfYear(Date date)
  5. getWeekOfDate(Date dt)
  6. getWeekOfMonth(Date date)
  7. getWeekOfMonth(final Date date)
  8. getWeekOfMonthFirstDay(Date dt)
  9. getWeekOfTheYear(Date aDate)