刚开始使用new Date(),并通过date.getMonth(),和date.getDay()获取,发现获取时间一直不对,后来发现这两个获取方式是jdk1.1版本的,现在已经不用了.
后来查看[Java ]doc文档,MONTH字段解释如下
Field number for get and set indicating the month.
This is a calendar-specific value.
The first month of the year is JANUARY which is 0;
the last depends on the number of months in a year.
马个鸡,这家伙不就是和数组list一个样吗,下标从0开始算得...
int month = (date.get(Calendar.MONTH))+1;
int day = date.get(Calendar.DAY_OF_MONTH);
获取当前的月份和日期
试了一下,果然正确