我想讓程序調用當前日期,將30天添加到它,然後將該日期作爲字符串輸出。將日曆日期轉換爲字符串?
// Set calendar for due date on invoice gui
Calendar cal = Calendar.getInstance();
// Add 30 days to the calendar for the due date
cal.add(Calendar.DATE, 30);
Date dueDate = cal.getTime();
dueDatestr = Calendar.toString(dueDate);
什麼問題? toString()的用法看起來有點奇怪。 – 2009-10-31 01:46:39