Java Day of Week dayOfWeek(Date date)

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

Description

day Of Week

License

Open Source License

Declaration

public static int dayOfWeek(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 dayOfWeek(Date date) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);//  w w  w.ja va2  s  .co  m
        int dayWeek = cal.get(Calendar.DAY_OF_WEEK);
        return dayWeek;
    }

    public static int dayOfWeek(int year, int month, int day) {
        Calendar cal = Calendar.getInstance();
        cal.set(year, month - 1, day);
        int dayWeek = cal.get(Calendar.DAY_OF_WEEK);
        return dayWeek;
    }
}

Related

  1. dayForWeek(String pTime)
  2. dayForWeek(String pTime)
  3. dayForWeek(String weeks)
  4. dayNumberOfWeek(Date date)
  5. DayOfTheWeek(Date dt)
  6. dayOfWeek(Date inDate, TimeZone timeZone)
  7. dayOfWeek(Date time)
  8. dayOfWeek(int dayMark)
  9. dayOfWeek(int year, int month, int day)