/**
* 获得用户与的使用周期
*/
public List<String> getSlots(User user) throws Exception{
List<String> slots = new ArrayList<String>();
Calendar from = Calendar.getInstance();
Calendar to = Calendar.getInstance();
Date start = new SimpleDateFormat("yyyy-MM-dd").parse(user.getStart());
Date stop = new SimpleDateFormat("yyyy-MM-dd").parse(user.getStop());
from.setTime(start);
to.setTime(stop);
to.add(Calendar.DAY_OF_YEAR, 1);
while (from.getTime().getTime()!= to.getTime().getTime()) {
slots.add(new SimpleDateFormat("yyyy-MM-dd").format(from.getTime()));
from.add(Calendar.DAY_OF_YEAR, 1);
}
to.add(Calendar.DAY_OF_YEAR, -1);
return slots;
}
* 获得用户与的使用周期
*/
public List<String> getSlots(User user) throws Exception{
List<String> slots = new ArrayList<String>();
Calendar from = Calendar.getInstance();
Calendar to = Calendar.getInstance();
Date start = new SimpleDateFormat("yyyy-MM-dd").parse(user.getStart());
Date stop = new SimpleDateFormat("yyyy-MM-dd").parse(user.getStop());
from.setTime(start);
to.setTime(stop);
to.add(Calendar.DAY_OF_YEAR, 1);
while (from.getTime().getTime()!= to.getTime().getTime()) {
slots.add(new SimpleDateFormat("yyyy-MM-dd").format(from.getTime()));
from.add(Calendar.DAY_OF_YEAR, 1);
}
to.add(Calendar.DAY_OF_YEAR, -1);
return slots;
}