I have a date string "2012-01-26" which I get from JSON.
I have to now check if the month and year is as current year than display data it in ListView.
SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-DD");
try {
Calendar c = Calendar.getInstance();
c.setTime(dateFormat.parse(event_start_date));
int month = c.get(Calendar.MONTH);
System.out.println(c.get(Calendar.YEAR));
System.out.println("month is"+month);
}
Year value is always correct, but the Month is always zero.What am I missing guys?