Calendar returns wrong month [duplicate]
As is clear by the many answers: the month starts with 0.
Here's a tip: you should be using SimpleDateFormat to get the String-representation of the month:
Calendar rightNow = Calendar.getInstance();java.text.SimpleDateFormat df1 = new java.text.SimpleDateFormat("MM");java.text.SimpleDateFormat df2 = new java.text.SimpleDateFormat("MMM");java.text.SimpleDateFormat df3 = new java.text.SimpleDateFormat("MMMM");System.out.println(df1.format(rightNow.getTime()));System.out.println(df2.format(rightNow.getTime()));System.out.println(df3.format(rightNow.getTime()));
Output:
11NovNovember
Note: the output may vary, it is Locale-specific.