import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
public class test {
public static void main(String[] args) {
// 本月的第一天
Calendar calendar = new GregorianCalendar();
calendar.set( Calendar.DATE, 1 );
SimpleDateFormat simpleFormate = new SimpleDateFormat( "yyyy-MM-dd" );
System.out.println(simpleFormate.format(calendar.getTime()));
// 本月的最后一天
calendar.set( Calendar.DATE, 1 );
calendar.roll(Calendar.DATE, - 1 );
System.out.println(simpleFormate.format(calendar.getTime()));
}
}