Possible Duplicate:
Calendar returns wrong month
I want to retrieve the date and time for my application, for which I wrote the following code
Calendar c = Calendar.getInstance();
System.err.println("Date is: " + c.get(Calendar.DATE));
System.err.println("Month is: " + c.get(Calendar.MONTH));
System.err.println("Year is: " + c.get(Calendar.YEAR));
System.err.println("Hour is: " + c.get(Calendar.HOUR_OF_DAY));
However the preceding code snippet is providing incorrect result.
SEVERE: Date is: 31
SEVERE: Month is: 11
SEVERE: Year is: 2012
SEVERE: Hour is: 17
NOTE: The time on my machine is perfect, no problem there