我有一个二维字符串数组
static String[][] TaskStorage = {
{"Task 1","02/07/13"},
{"Task 2","02/08/13"},
{"Task 3","02/09/13"},
{"Task 4","02/10/13"},
{"Task 5","02/11/13"},
{"Task 6","02/03/13"},
{"Task 7","02/04/13"},
{"Task 8","02/05/13"},
{"Task 9","02/06/13"},
{"Task 10","03/01/13"},
{"Task 11","03/02/13"},
{"Task 12","03/03/13"},
};
我想打印所有 TaskStorage[0][i],其中 TaskStorage[i][1] 是 02/07 和 02/08。考虑到今天的日期是 02/04。今天日期可以更改为 02/28。todayDate 将基于代码的执行时间。
基本上是提前两天打印的任务。
这是我尝试过的:
SimpleDateFormat dateFormat = new SimpleDateFormat("mm/dd/yy");
TaskDate = dateFormat.parse(LinkStorage[i][1]);
if (todayDate.after(TaskDate)) {
System.out.println("");
}