Android Date Get getDayOfWeek(String year, String month, String day)

Here you can find the source of getDayOfWeek(String year, String month, String day)

Description

get Day Of Week

Declaration

public static int getDayOfWeek(String year, String month, String day) 

Method Source Code

//package com.java2s;

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

public class Main {
    public static int getDayOfWeek(String year, String month, String day) {
        Calendar cal = new GregorianCalendar(Integer.valueOf(year)
                .intValue(), Integer.valueOf(month).intValue() - 1, Integer
                .valueOf(day).intValue());
        return cal.get(Calendar.DAY_OF_WEEK);
    }//from  ww  w.j a  va 2 s .co  m

    public static int getDayOfWeek(String date) {
        String[] temp = null;
        if (date.indexOf("/") > 0) {
            temp = date.split("/");
        }
        if (date.indexOf("-") > 0) {
            temp = date.split("-");
        }
        return getDayOfWeek(temp[0], temp[1], temp[2]);
    }

    public static int getDayOfWeek(Date date) {
        Calendar cal = new GregorianCalendar();
        cal.setTime(date);
        return cal.get(Calendar.DAY_OF_WEEK);
    }
}

Related

  1. getDateObj(int year, int month, int day)
  2. getDateOffset(String date, int offset)
  3. getDateTomorrow(String date)
  4. getDayOfWeek(Date date)
  5. getDayOfWeek(String date)
  6. getDayofWeekInMonth(String year, String month, String weekOfMonth, String dayOfWeek)
  7. getDaysOfCurMonth()
  8. getDaysOfCurMonth(final String time)
  9. getMonth(Date date)