Android examples for java.util:Day
Get the day of the date
import android.annotation.SuppressLint; import android.text.format.Time; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Locale; public class Main{ /**//from w w w. j a va2s . c om * <br> * Get the day of the date * @param year 2012 * @param month 5 * @param$day 21 * @return 1:Sun ~ 7:Sat */ public static int dayIndexOfWeek(int year, int month, int day) { Calendar calendar = Calendar.getInstance(); calendar.set(year, month - 1, day); return calendar.get(Calendar.DAY_OF_WEEK); } }