Here you can find the source of getPreMonth(String thisMonth)
public static String getPreMonth(String thisMonth)
//package com.java2s; //License from project: Open Source License public class Main { public static String getPreMonth(String thisMonth) { String yearMonth[] = thisMonth.split("-"); int month = Integer.parseInt(yearMonth[1]); if (month > 1) { return yearMonth[0] + "-" + String.format("%02d", month - 1); }/* w w w. j av a2 s. c o m*/ int year = Integer.parseInt(yearMonth[0]); return (year - 1) + "-12"; } }