Here you can find the source of getPrevMonth(String divisionDate, int day, String outputFormat)
public static String getPrevMonth(String divisionDate, int day, String outputFormat) throws Exception
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; public class Main { public static String getPrevMonth(String divisionDate, int day, String outputFormat) throws Exception { Calendar cal = Calendar.getInstance(); cal.set(cal.YEAR, Integer.parseInt(divisionDate.substring(0, 4))); cal.set(cal.MONTH, Integer.parseInt(divisionDate.substring(4, 6)) - 1); cal.set(cal.DATE, Integer.parseInt(divisionDate.substring(6, 8))); cal.add(cal.MONTH, day);// ww w.j a v a 2 s . c o m Locale locale = new Locale("KOREAN", "KOREA"); SimpleDateFormat formatter = new SimpleDateFormat(outputFormat, locale); return formatter.format(cal.getTime()); } }