Java Date get day of week

Description

Java Date get day of week

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

public class Main {
  public static void main(String[] argv) {
    Date date = new Date();
    System.out.println(getDateIsWeek(date));
  }/* ww w.j ava  2  s . co  m*/

  public static int getDateIsWeek(Date date) {
    Calendar c = Calendar.getInstance();
    c.setTime(date);
    int week = c.get(Calendar.DAY_OF_WEEK);
    return week;
  }
}



PreviousNext

Related