日期:2014-05-18 浏览次数:20666 次
time yl wd
8:00
9:00
10:00
11:00
12:00
13:00
14:00
15:00
16:00
17:00
18:00
19:00
20:00
21:00
22:00
23:00
00:00
01:00
02:00
03:00
04:00
05:00
06:00
07:00
public static void main(String[] args) {
String str = "";
List<CalendarTestClass> list = new ArrayList<CalendarTestClass>();
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
Calendar cal = Calendar.getInstance();
cal.set(Calendar.MINUTE, 0);
for (int num = 0; num < 24; num++) {
cal.set(Calendar.HOUR_OF_DAY, 8);
cal.add(Calendar.HOUR, num);
Date date = cal.getTime();
str = sdf.format(date);
list.add(getTime(str));
}
}
public CalendarTestClass getTime(String str){
CalendarTestClass calendar = new CalendarTestClass();
calendar.setName(str);
return calendar;
}
}
public class CalendarTestClass {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}