Android Day of Week Get getDayofWeekInMonth(String year, String month, String weekOfMonth, String dayOfWeek)

Here you can find the source of getDayofWeekInMonth(String year, String month, String weekOfMonth, String dayOfWeek)

Description

get Dayof Week In Month

License

Apache License

Declaration

public static int getDayofWeekInMonth(String year, String month,
        String weekOfMonth, String dayOfWeek) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Calendar;

import java.util.GregorianCalendar;

public class Main {

    public static int getDayofWeekInMonth(String year, String month,
            String weekOfMonth, String dayOfWeek) {
        Calendar cal = new GregorianCalendar();
        int y = new Integer(year).intValue();
        int m = new Integer(month).intValue();
        cal.clear();/*from w w  w.j  av  a 2s  .  c  o  m*/
        cal.set(y, m - 1, 1);
        cal.set(Calendar.DAY_OF_WEEK_IN_MONTH,
                new Integer(weekOfMonth).intValue());
        cal.set(Calendar.DAY_OF_WEEK, new Integer(dayOfWeek).intValue());
        return cal.get(Calendar.DAY_OF_MONTH);
    }
}

Related

  1. getDayOfWeekString(int dayOfWeek, int abbrev)
  2. getDayOfWeek(String year, String month, String day)
  3. getDayOfWeek(String date)
  4. getDayOfWeek(Date date)
  5. getFirstDayOfWeek()