?
?1
//
本月的第一天
?2
Calendar?calendar?
=
?
new
?GregorianCalendar();
?3
calendar.set(?Calendar.DATE,?
1
);
?4
SimpleDateFormat?simpleFormate?
=
?
new
?SimpleDateFormat(
"
yyyy-MM-dd
"
);
?5
System.out.println(simpleFormate.format(calendar.getTime()));
?6
?7
//
本月的最后一天
?8
Calendar?calendar?
=
?
new
?GregorianCalendar();
?9
calendar.set(?Calendar.DATE,?
1
);
10
calendar.roll(Calendar.DATE,?
-
1
);
11
SimpleDateFormat?simpleFormate?
=
?
new
?SimpleDateFormat(
"
yyyy-MM-dd
"
);
12
System.out.println(simpleFormate.format(calendar.getTime()));
13
14

?2

?3

?4

?5

?6

?7

?8

?9

10

11

12

13

14
