Código:
cuando ejecuto el codigo en consola todo marcha bien excepto para marzo y abril:public long diasDifferencia(String fechaInit, String fechaEnd){
String[] dateInit = fechaInit.split("/");
String[] dateEnd = fechaEnd.split("/");
Date dInit = new GregorianCalendar(yInit, Integer.parseInt(dateInit[1])-1, Integer.parseInt(dateInit[0])).getTime();
Date dEnd = new GregorianCalendar(yEnd, Integer.parseInt(dateEnd[1])-1, Integer.parseInt(dateEnd[0])).getTime();
long diff = (dEnd.getTime() - dInit.getTime())/(1000 * 60 * 60 * 24);
return diff;
}
Código:
El resultado para el "01/04/2002" deberia ser 89 y lo toma como si fuera el ultimo dia de marzo. No identifico el error.System.out.println(diasDifferencia("02/01/2001","02/01/2002"));
// resultado: 365 (bien)
System.out.println(diasDifferencia("02/01/2002","31/03/2002"));
// resultado: 88 (bien)
System.out.println(diasDifferencia("02/01/2002","01/04/2002"));
// resultado: 88 (mal)
Gracias de antemano por su ayuda.


