我有一個程序需要在2009年1月1日開始,當我開始新的一天時,我的程序將在第二天顯示。 這是我到目前爲止有:將日期添加到日期
GregorianCalendar startDate = new GregorianCalendar(2009, Calendar.JANUARY, 1);
SimpleDateFormat sdf = new SimpleDateFormat("d/M/yyyy");
public void setStart()
{
startDate.setLenient(false);
System.out.println(sdf.format(startDate.getTime()));
}
public void today()
{
newDay = startDate.add(5, 1);
System.out.println(newDay);
//I want to add a day to the start day and when I start another new day, I want to add another day to that.
}
我收到錯誤發現無效,但預計INT,在「newDay = startDate.add(5,1);」 我該怎麼辦?
幾個小時內約三個問題。也許是時候先看看API了。 – camickr 2009-09-13 05:22:34