Java Day of Week getWeek(java.util.Date date)

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

Description

get Week

License

Open Source License

Declaration

public static int getWeek(java.util.Date date) 

Method Source Code

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

import java.util.Calendar;

public class Main {
    public static int getWeek(java.util.Date date) {
        java.util.Calendar c = java.util.Calendar.getInstance();
        c.setTime(date);//from w  w  w  .j a va  2 s  .  c  o m
        int dayOfWeek = c.get(java.util.Calendar.DAY_OF_WEEK);
        dayOfWeek = dayOfWeek - 1;
        if (dayOfWeek == 0) {
            dayOfWeek = Calendar.DAY_OF_WEEK;
        }
        return dayOfWeek;
    }
}

Related

  1. getThisweekFirst(Date early)
  2. getWeek(Date date)
  3. getWeek(Date date)
  4. getWeek(Date dateParam)
  5. getWeek(Date today)
  6. getWeek(java.util.Date today)
  7. getWeekBegin(Date date)
  8. getWeekCategory(final Date date)
  9. getWeekChineseIndex(Date curDate)