title: Error in Retrieving Year Month Date from Calender object
body: <p>All this is my program where i am trying the folowing </p>
  
  <p><strong>Below is my code for Dates functionality...</strong></p>
  
  <pre><code>import java.text.SimpleDateFormat;
  import java.util.*;
  import java.text.*;
  public class DateToCalender {
  public static void main(String args[]){
  //String strFormat="yyyymmdd";
  
  //DateFormat myDateFormat = new SimpleDateFormat(strFormat);
  DateFormat df= new SimpleDateFormat("yyyyMMdd");
  df.setLenient(false);
  Calendar start=Calendar.getInstance();
  try {
  Date fromDt =(Date)df.parse("20111207");
  //Date myDate = new Date();
  //myDate = (Date)myDateFormat.parse("20111207");
  //myGDate.setTime(myDate);
  start.setTime(fromDt);
  
                  start.set(Calendar.MONTH,(start.get(Calendar.MONTH)+1));
  System.out.println(start);
  
  System.out.println(start.get(Calendar.YEAR));
  System.out.println(start.get(Calendar.MONTH)-1);
  System.out.println(start.get(Calendar.DAY_OF_MONTH));
  //System.out.println("From My class"+myGDate.get(Calendar.MONTH));
  
  //System.out.println("From My class new month"+(myGDate.get(Calendar.MONTH)+1));
  
  } catch (ParseException e) {
  System.out.println("Invalid Date Parser Exception ");
  e.printStackTrace();
  }
  } 
  }  
  </code></pre>
  
  <p>when iam executing this code iam getting folowwing o/p</p>
  
  <pre><code>java.util.GregorianCalendar[time=?,areFieldsSet=false,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Asia/Calcutta",offset=19800000,dstSavings=0,useDaylight=false,transitions=6,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA
  =1,YEAR=2011,MONTH=12,WEEK_OF_YEAR=50,WEEK_OF_MONTH=2,DAY_OF_MONTH=7,DAY_OF_YEAR=341,DAY_OF_WEEK=4,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=19800000,DST_OFFSET=0]
  2011
  0
  7
  </code></pre>
  
  <p>**
   <strong>issue is :</strong> </p>
  
  <pre><code>Though iam entering date as 2011/12/07
              I am getting     year as 2011
                               month as 0
                               date as 7
  Can some one help in resolving above issue
  </code></pre>
  
  <p>Could any body please let me know , how this can be resolved .</p>