public static String doDateAdd(int year, int month, int dayofyear, int hour) {
Calendar cal = new GregorianCalendar(Locale.KOREA);
cal.setTime(new Date());
cal.add(Calendar.YEAR, year);
cal.add(Calendar.MONTH, month);
cal.add(Calendar.DAY_OF_YEAR, dayofyear);
cal.add(Calendar.HOUR, hour);
SimpleDateFormat fm = new SimpleDateFormat("yyyy-MM-dd");
String strDate = fm.format(cal.getTime());
return strDate;
}
오늘 날짜가 2016-12-14 인데
String date = doDateAdd(0, 1, 0, 0); // 1달 추가
위와 같은 경우에
리턴값이 2016-01-14 인가요
아님 한달 추가 되고 年이 자동으로 넘어가서 2017-01-14 가 되나요?
12랑 01이 **으로 나오네 ㄷㄷ
자동으로 넘어가지
왜 안넘어가겠냐 상식적으로
감사합니다 야매로 배워서 모르는게 너무 많아요
내게 1월1일은 없다고 32일이라고 33일이라고~~~ 오우예~~`