/**
* get before data
* @param c Calendar object
* @param num want to get the number of days
* @return ArrayLsit of days
*/
public ArrayList<String> getBeforDay(Calendar c,int num)
{
ArrayList<String> dataArr = new ArrayList<String>();
while(num >= 0)
{
int month = c.get(Calendar.MONTH)+1;
int day = c.get(Calendar.DATE);
String data = month + "/" + day;
dataArr.add(data);
//set before day
c.set(Calendar.DATE, day-1);
num--;
}
return dataArr;
}
获得日期的前几天或者后几天
最新推荐文章于 2023-11-29 14:01:16 发布