import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.Period;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import java.util.Locale;
/**
* 월 달력 생성기
*
* @author
*/
public class Test {
public static void main(String[] args) {
final int addMonth = 2; //2개월 후 데이터 생성
DateTimeFormatter fmtMonth = DateTimeFormat.forPattern("yyyyMM");
DateTimeFormatter fmtDay = DateTimeFormat.forPattern("yyyyMMdd");
//대상 월
DateTime now = DateTime.now();
String strTargetMonth = now.plus(Period.months(addMonth)).toString(fmtMonth);
DateTime dt = DateTime.parse(strTargetMonth, fmtMonth);
int startDay = dt.dayOfMonth().getMinimumValue();
int endDay = dt.dayOfMonth().getMaximumValue();
String strDay;
String dayOfWeek;
//boolean isHoliDay = false;
for (int i = startDay; i <= endDay; i++) {
strDay = strTargetMonth + StringUtils.leftPad(Integer.toString(i), 2, "0");
dayOfWeek = DateTime.parse(strDay, fmtDay).dayOfWeek().getAsShortText(Locale.KOREA);
System.out.println(String.format("%s | %s", strDay, dayOfWeek));
}
}
}