Using Java API to get next month

Hello All,

The subject says it all: I am having an issue determining the next month value within my Java app.


   	Calendar cal = GregorianCalendar.getInstance();
    	SimpleDateFormat df = new SimpleDateFormat("MMMM yyyy");

    	Date currentMonth = new Date();
    	cal.setTime(currentMonth);

    	// current month
    	String currentMonthAsSting = df.format(cal.getTime());

    	// Add next month
	cal.set(Calendar.MONTH, cal.get(Calendar.MONTH)+1);
   	String nextMonthAsString = df.format(cal.getTime());


Up until today (Oct. 31, 2006) this function determined this month to be ‘October 2006’ and next month to be ‘November 2006’.
Today, however, I am seeing this month to be ‘October 2006’ and next month to be ‘December 2006’.

Can anyone suggest what I am doing wrong?

Thans a lot!

It just occured to me that I probably should be using


cal.add(Calendar.MONTH, 1);

instead of


cal.set(Calendar.MONTH, cal.get(Calendar.MONTH)+1);