Android examples for java.util:Week
get Week Day From Date
import android.annotation.SuppressLint; import android.util.Log; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main{ public static int getWeekDayFromDate(int year, int month) { Calendar cal = Calendar.getInstance(); cal.setTime(getDateFromString(year, month)); int week_index = cal.get(Calendar.DAY_OF_WEEK) - 1; if (week_index < 0) { week_index = 0;/*w w w . j a v a 2s . c om*/ } return week_index; } }