Here you can find the source of getMReportTime(String time)
public static Date[] getMReportTime(String time) throws Exception
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static Date[] getMReportTime(String time) throws Exception { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM"); Date date = dateFormat.parse(time); Calendar calendar = Calendar.getInstance(); calendar.setTime(date);//from w ww. ja v a 2 s . com calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) + 1); calendar.set(Calendar.DAY_OF_MONTH, 0); Date[] dates = new Date[2]; dates[1] = calendar.getTime(); dates[0] = date; return dates; } }