Android examples for java.util:Month
get Days Of Month
//package com.java2s; import java.util.Calendar; public class Main { public static int getDaysOfMonth() { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.DATE, 1);// calendar.roll(Calendar.DATE, -1);// int maxDate = calendar.get(Calendar.DATE); return maxDate; }//from ww w . j a v a 2 s. c om public static int getDaysOfMonth(int year, int month) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, month - 1); calendar.set(Calendar.DATE, 1);// calendar.roll(Calendar.DATE, -1);// int maxDate = calendar.get(Calendar.DATE); return maxDate; } }