What would you expect this code to print?
Calendar c = new GregorianCalendar(2004, 12, 30); System.out.println(c.getTime());Well of course, it prints
Sun Jan 30 00:00:00 PST 2005Because as everyone knows, we number days starting at 1 but months starting at 0. And because 12 isn't a valid month if you count from 0, clearly you want Java to silently round up to the next year rather than, say, throw an exception. Yes, in Java 2004-12-30 means 2005-01-30.
And don't go looking for some obvious method, say Calendar.getMonth(). No, what you really meant was Calendar.get(Calendar.MONTH).