date is not working properly
Following is the code for adding date
public boolean addDate(int iDate)
{
Calendar cal = Calendar.getInstance();
cal.set(2009,02,01);
cal.add(Calendar.DATE, iDate); // Add days in Dates in Calendar
System.out.println("Date :"+cal.get(Calendar.DATE));
System.out.println("Month :"+cal.get(Calendar.MONTH));
System.out.println("Year :"+cal.get(Calendar.YEAR));
return true;
}
calling the function.
addDate(30);
But the output is giving wrongly, previously for couple of months it was working fine, but now I don't understand why the date function is throwing wrong error
Date :31
Month :2
Year :2009
I don't understand what to do!