Here you can find the source of GetDay(int month)
public static String GetDay(int month)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { /**//from w ww. jav a 2 s .c om * * @param strFormat * @param iDays * @return update 2012-9-7 */ public static String GetDay(String strFormat, int iDays) { Date cDate = new Date(); cDate = AddDate(cDate, iDays); SimpleDateFormat cSimpleDateFormat = new SimpleDateFormat(strFormat); return cSimpleDateFormat.format(cDate); } public static String GetDay(int month) { java.util.Calendar cal = java.util.Calendar.getInstance(); java.text.SimpleDateFormat sDateFormat = new SimpleDateFormat( "yyyy-MM-dd"); cal.add(Calendar.MONTH, month); sDateFormat.format(cal.getTime()); System.out.println(sDateFormat.format(cal.getTime())); return sDateFormat.format(cal.getTime()); } /** * * @param date * Date * @param days * int * @return Date */ public static Date AddDate(Date date, int days) { Calendar c = Calendar.getInstance(); c.setTime(date); long lTmp = c.getTimeInMillis(); c.setTimeInMillis(lTmp + ((long) days) * 24 * 3600 * 1000); return c.getTime(); } }