This is the problem:
GregorianCalendar enteredDate = new GregorianCalendar(year, month, day);
That's going to be calling new GregorianCalendar(2013, 10, 10)
- which means November, not October.
From the GregorianCalendar
constructor docs:
month
- the value used to set the MONTH calendar field in the calendar. Month value is 0-based. e.g., 0 for January.
Two other bits of advice:
- If you have to use just the Java libraries, use
SimpleDateFormat
to perform the parsing, rather than doing it yourself - If you possibly can, use Joda Time instead, which is a much more sensible API