Code example for Calendar

Methods: getgetActualMaximumset

    private final static Calendar SAMPLE_DATE = Calendar.getInstance();
        SAMPLE_DATE.set(SAMPLE_DATE.get(Calendar.YEAR), SAMPLE_DATE.getActualMaximum(Calendar.MONTH), SAMPLE_DATE.getActualMaximum(Calendar.DAY_OF_MONTH));
    public static final String SHORT_FORMAT = "SHORT";
    public static final String MEDIUM_FORMAT = "MEDIUM";
    public static final String DEFAULT_FORMAT = SHORT_FORMAT;
    public static final String PREF_KEY = "dateFormat";
    private static volatile String sChosenFormat = null;
    public static String getSampleDate(Context context, String formatString)
        java.text.DateFormat formatter = getDateFormat(context, formatString);
        return formatter.format(SAMPLE_DATE.getTime());
Connect your IDE to all the code out there  Get Codota for Java